在 Adobe AIR Flex 4 中的 HTML 组件内运行 javascript?
我在 Flex 4 的 AIR 应用程序中具有以下组件:
<mx:HTML id="viewObject"
x="10" y="42" width="634" height="313"
location="http;//localhost:8080/mypage.php" />
现在我想在页面加载时运行 javascript,但 javascript 不在目标页面内。我想运行以下 javascript:
javascript:alert('Hello world.');
我尝试通过在页面加载后再次将 location 属性设置为 javascript 来接近它,如下所示。
<s:Button x="10" y="10" label="Button">
<s:click>
<![CDATA[
viewObject.location = "javascript:alert('hello world');";
]]>
</s:click>
</s:Button>
不幸的是,对我来说,这似乎不起作用。有人能帮我解决这个问题吗?
I have the following component in an AIR application from Flex 4:
<mx:HTML id="viewObject"
x="10" y="42" width="634" height="313"
location="http;//localhost:8080/mypage.php" />
Now I want to run a javascript when the page loads but the javascript isn't inside the target page. I want to run the following javascript:
javascript:alert('Hello world.');
I tried approaching it by setting the location property again to the javascript after the page has loaded like below.
<s:Button x="10" y="10" label="Button">
<s:click>
<![CDATA[
viewObject.location = "javascript:alert('hello world');";
]]>
</s:click>
</s:Button>
Unfortunately for me, that doesn't seem to work. Can anybody help me out with this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为位置就像使用地址栏一样。你需要做的是这样的:
我认为这应该可行。
That's because location is like using the address bar. What you need to do is something like this:
I think that should work.