如何通过as代码设置flex控件的Effect
怎么通过as代码设置flex控件的Effect
如这两个标签标示的button的Effect,怎么用as脚本代码来编写,怎么通过as代码设置Button控件的mouseUpEffect?
按钮是动态生成的,所以要动态添加Effect
------解决方案--------------------
楼上的好像不对呀,应该是这样吧:
var gw:Glow =new Glow();
gw.alphaFrom=0.1;
gw.alphaTo=1;
gw.target = btn;
然后监听btn的mouseUp事件,当事件触发的时候执行gw.play();
如下:
btn.addEvenListener(MouseEvent.MOUSE_UP,function(evt:Event):void{
gw.play();
});
我没验证过,不过我记得好像是这样做的..
- XML code
<mx:Glow id="buttonGlow" color="0x99FF66" alphaFrom="1.0" alphaTo="0.3" duration="1500"/> <mx:Button x="40" y="60" label="View" id="myButton" mouseUpEffect="{buttonGlow}"/>
如这两个标签标示的button的Effect,怎么用as脚本代码来编写,怎么通过as代码设置Button控件的mouseUpEffect?
按钮是动态生成的,所以要动态添加Effect
------解决方案--------------------
楼上的好像不对呀,应该是这样吧:
var gw:Glow =new Glow();
gw.alphaFrom=0.1;
gw.alphaTo=1;
gw.target = btn;
然后监听btn的mouseUp事件,当事件触发的时候执行gw.play();
如下:
btn.addEvenListener(MouseEvent.MOUSE_UP,function(evt:Event):void{
gw.play();
});
我没验证过,不过我记得好像是这样做的..