| |
| Change button position and fade button |
|
|
 |
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
private function changeState() : void {
currentState = (currentState == null) ? "alternate" : null;
}
</mx:Script>
<mx:states>
<mx:State name="alternate">
<mx:SetProperty target="{button2}" name="x" value="100"/>
<mx:SetProperty target="{button2}" name="y" value="10"/>
<mx:SetProperty target="{button3}" name="visible" value="false"/>
</mx:State>
</mx:states>
<mx:transitions>
<mx:Transition toState="alternate">
<mx:Parallel>
<mx:Fade target="{ button3 }" />
<mx:Fade target="{ button1 }" />
<mx:Move target="{ button2 }" />
<mx:Fade target="{ button3 }" alphaTo="1" />
</mx:Parallel>
</mx:Transition>
<mx:Transition toState="">
<mx:Sequence>
<mx:Move target="{ button1 }" />
<mx:Fade target="{ button1 }" alphaTo="1" />
<mx:Move target="{ button2 }" />
<mx:Fade target="{ button3 }" alphaTo="1" />
</mx:Sequence>
</mx:Transition>
</mx:transitions>
<mx:Button x="10" y="10" label="Button 1" id="button1" click="changeState()" />
<mx:Button x="10" y="40" label="Button 2" id="button2" click="changeState()" />
<mx:Button x="10" y="70" label="Button 3" id="button3" click="changeState()" />
</mx:Application>
|
|
|
| Related examples in the same category |
|