Flex Toggle Button 开关按钮

 <?xml version="1.0" encoding="utf-8"?>
<mx:Button skin="{lockup}" toolTip="锁定"
 click="onClickBtn(event)" xmlns:mx="http://www.adobe.com/2006/mxml" toggle="true"
    downSkin="{null}" upSkin="{null}" overSkin="{null}" focusSkin="{null}" >
 <mx:Script>
  <![CDATA[
   [Embed(source="assets/lockup.png")]
   private static var lockup:Class;
  
   [Embed(source="assets/lockdown.png")]
   private static var lockdown:Class;
   
  
   private function onClickBtn(event:MouseEvent):void{    
    if(this.selected)
    {
     this.setStyle("skin", lockdown);
     this.toolTip="解锁";
    }
    else
    {
     this.setStyle("skin", lockup);
     this.toolTip="锁定";
    }
   }
  ]]>
 </mx:Script>
</mx:Button>

你可能感兴趣的:(xml,Flex,Adobe)