Apache flex 在AIR HTML控件中的链接悬停上显示url
有人知道在AIR HTML控件中是否有一种捕获悬停链接url的简单方法吗?就像在浏览器中一样,我希望url显示在状态栏中,但我找不到在链接滚动时引发的任何事件。我是否需要亲自检查并操作DOM?假设您使用的是mx:HTML或HTMLLoader,您可能需要自己编写一个小脚本来将DOM对象连接到空气容器。这里有一个方法——可能有一个更优雅的解决方案,但为了说明,它应该足够了Apache flex 在AIR HTML控件中的链接悬停上显示url,apache-flex,dom,air,Apache Flex,Dom,Air,有人知道在AIR HTML控件中是否有一种捕获悬停链接url的简单方法吗?就像在浏览器中一样,我希望url显示在状态栏中,但我找不到在链接滚动时引发的任何事件。我是否需要亲自检查并操作DOM?假设您使用的是mx:HTML或HTMLLoader,您可能需要自己编写一个小脚本来将DOM对象连接到空气容器。这里有一个方法——可能有一个更优雅的解决方案,但为了说明,它应该足够了 <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApp
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="1024" height="768" xmlns:html="flash.html.*" horizontalScrollPolicy="off">
<mx:Script>
<![CDATA[
private function container_complete(event:Event):void
{
addHTMLListeners();
}
private function addHTMLListeners():void
{
var links:Object = container.htmlLoader.window.document.getElementsByTagName("a");
for (var i:int = 0; i < links.length; i++)
{
if (links[i].href != "")
{
var href:String = links[i].href;
links[i].onmouseover = function():void { setStatus(this); };
links[i].onmouseout = function():void { clearStatus() };
}
}
}
private function setStatus(o:Object):void
{
status = o.href;
}
private function clearStatus():void
{
status = "";
}
]]>
</mx:Script>
<mx:HTML id="container" location="http://stackoverflow.com/users/32129" width="100%" height="100%" complete="container_complete(event)" />
</mx:WindowedApplication>
希望有帮助