我在flex中设计一个页面,我有一个图像。当用户将鼠标悬停在图像上时,应该显示特定的文本。下面是我写我的ActionScript代码,但它不工作(它没有显示在鼠标悬停事件文本:(mouseover动作脚本
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="100" minHeight="100">
<fx:Script>
private var helpText:String = "Some Text."
private function helpIconEvent(e:MouseEvent):void{
if(e.type == "mouseOver"){
e.currentTarget.helpText.visible = true;
}
}
private function addEventToHelpIcon():void {
helpIcon.addEventListener(MouseEvent.MOUSE_OVER, helpIconEvent);
}
</fx:Script>
<mx:Image id="helpIcon" x="270" y="187" width="50" height="50" mouseOver="addEventToHelpIcon"
source="source_path"/>
任何帮助/洞察力将不胜感激。
感谢。
首先应该创建新的'有'ID ='helpText'' – mgraph
text'元素我已经做到了::::私人变种HELPTEXT :String =“一些文字”。 – javaIQ