2013年5月29日 星期三

[Flex] state

<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"
  xmlns:ns1="*"
  xmlns:net="flash.net.*"
  minWidth="955" minHeight="600"
  width="1024" height="768">

        <s:states>
 <s:State name="default"/>
 <s:State name="other"/>
</s:states>

<fx:Script>
<![CDATA[

                       private function toggleState(event:MouseEvent):void
{
switch (currentState) {
case "other":
currentState = "default";
break;
case "default":
currentState = "other";
break;
}
}
               ]]>
</fx:Script>

       <s:VGroup>
       <s:Button label="Change State" id="btnChangeState" click="toggleState(event)"/>
       <s:Button label="in default" includeIn="default"/>
       <s:Button label="in other" includeIn="other"/>
       </s:VGroup>
</s:Application>

沒有留言:

張貼留言