可以说我有一个包含表单的html文件:

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

我们已在swf文件中使用HTMLLoader加载了该html文件。
_htmlLoader = new HTMLLoader();
_htmlLoader.paintsDefaultBackground = false;
var req:URLRequest = new URLRequest(urlValue);
_htmlLoader.load(req);
_stage.addChild(_htmlLoader);

在主应用程序中使用Loader加载此Swf文件后,文本框为只读且无法键入。
但是我们可以使用Mouse改变它们的焦点。
var loader1:Loader = new Loader();
loader1.load(new URLRequest("path to file.swf"));
// ...
this.addChild(loader1);
// ...

有什么问题?

最佳答案

触发Event.COMPLETE事件后是否附加了HTMLLoader?在附加舞台之前,甚至值得等待HTMLLoader的文档触发DOMReady事件。

尝试这样的事情:

_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); }

Flex documentation about handling HTML events提到了这一点:



在实际准备好文档之前,可能会将HTMLLoader附加到阶段,这可能解释了一些怪异现象。

如果您还有其他更多信息,将对您有所帮助...

关于html - HTML Loader中的输入元素在Adobe AIR中为只读,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7711229/

10-11 01:50
查看更多