Input elements in HTMLLoader are read only in Adobe AIR

Suppose I have an html file containing the form:

<form method="post" action="url"> <input type="text" id="fullname" /> <input type="text" id="bodyText" /> <input type="submit"> </form> 

we loaded this html file using the HTMLLoader inside the swf file.

 _htmlLoader = new HTMLLoader(); _htmlLoader.paintsDefaultBackground = false; var req:URLRequest = new URLRequest(urlValue); _htmlLoader.load(req); _stage.addChild(_htmlLoader); 

After loading this SWF file using Loader inside the main application, the text fields are displayed only in read mode and cannot enter it. But we can focus on them with the mouse.

 var loader1:Loader = new Loader(); loader1.load(new URLRequest("path to file.swf")); // ... this.addChild(loader1); // ... 

What is the problem?

+6
source share
2 answers

Is HTMLLoader connected after Event.COMPLETE event? You might even expect the HTMLLoader document to fire the DOMReady event before binding it to the step.

Try something like this:

 _htmlLoader = new HTMLLoader(); _htmlLoader.paintsDefaultBackground = false; var urlRequest:URLRequest = new URLRequest(urlRequest); _htmlLoader.addEventListener(Event.COMPLETE, completeHandler); _htmlLoader.load(urlRequest); function completeHandler(event:Event):void { _htmlLoader.window.document.addEventListener("DOMContentLoaded", readyHandler); } function readyHandler(event:Event):void { _stage.addChild(_htmlLoader); } 

The Flex documentation on HTML event handling mentions the following:

When a listener refers to a specific DOM element, it is good practice to wait for the parent HTMLLoader to dispatch the full event before adding event listeners. HTML pages often load multiple files and the HTML DOM is not fully created until all files have been downloaded and parsed. HTMLLoader dispatches the full event when all elements are created.

Perhaps the HTMLLoader joins the stage before the document is really ready, which may explain some oddities.

If you have more information that would be amazing help ...

0
source

The proposed solution ("wait for DOMContentLoaded before addChild ") does not work for me.

Instead, it worked using the display state FULL_SCREEN_INTERACTIVE . According to Adobe's documentation about FULL_SCREEN :

"keyboard interactivity enabled for mobile

(I think he disabled other profiles such as Desktop).

So far FULL_SCREEN_INTERACTIVE :

Indicates that Stage is in full screen mode with keyboard interactivity enabled . Starting with Flash Player 11.3, this feature is supported both in AIR applications and in the browser.

So, in my case, the solution was:

 _stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE 
0
source

Source: https://habr.com/ru/post/898957/


All Articles