I have a little Adobe Air app and I want to have several 'views' within it. I can achieve these views using a ViewStack but am having difficulty finding a nice way to animate between them.
This is what I have tried and although it works, one view disappears before sliding into view when what I want is more like the DestroyTwitter app where the view and all controls slide out of view nicely:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="700" top="100" left="100" creationComplete="onComplete()">
<mx:Script>
<![CDATA[
import mx.core.Application;
private function onComplete():void
{
stack.selectedChild = stack1;
}
private function switchTab():void
{
if( stack.selectedChild == stack1 )
{
stack.selectedChild = stack2;
}
else
{
stack.selectedChild = stack1;
}
}
]]>
</mx:Script>
<mx:Move id="slideLeft" xFrom="{Application.application.width}" xTo="0" yTo="0" duration="500" />
<mx:Move id="slideRight" xFrom="0" xTo="{Application.application.width}" duration="500" />
<mx:ViewStack id="stack" width="200%" height="100%">
<mx:VBox id="stack1" width="100%" height="100%" backgroundColor="white" hideEffect="{slideRight}" >
<mx:Label text="Stack 1" />
<mx:Button label="Switch" click="switchTab()" />
</mx:VBox>
<mx:VBox id="stack2" width="100%" height="100%" backgroundColor="#cdcdcd" hideEffect="{slideLeft}" >
<mx:Label text="Stack 2" />
<mx:Button label="Switch" click="switchTab()" />
</mx:VBox>
</mx:ViewStack>
</mx:WindowedApplication>
Has anyone got any nicer ideas to try, be grateful for any response?