开发者

flex4 change custom btn icon

开发者 https://www.devze.com 2023-01-28 06:23 出处:网络
I followed the post here for Custom IconButton using flex4 link text However, I want to change the icon of the buttom at run time, so I create something like this in ActionScript :

I followed the post here for Custom IconButton using flex4 link text However, I want to change the icon of the buttom at run time, so I create something like this in ActionScript :

[Bindable] [@Embed('assets/1.png')]
public var pic1:Class;

[Bindable] [@Embed('assets/2.png')]
public var pic2:Class; 
public function clickToChange()
  {CustomBtn1.setStyle("icon", pic2);}

and my .mxml is

<local:CustomBtn id="CustomBtn1" icon=开发者_如何转开发'{pic1}' width="80" height="80" click=clickToChange();/>

But I can't get CustomBtn change from pic1 to pic2 when click it. Any hint which part I did wrong? Thanks.


Simply:

CustomBtn1.icon = pic2;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号