slide effects to Panel


<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”init2()”>
<mx:Script>
<![CDATA[
import mx.containers.Panel;
import mx.controls.Alert;
public var ar:Array=new Array();
public var tem:Panel=new Panel();
public var p1:Panel=new Panel();
public var p2:Panel=new Panel();
public var p3:Panel=new Panel();
public var p4:Panel=new Panel();
public var i:int=0;
private function init2():void
{
p1.title="personal";
p2.title="contact";
p3.title="qualification";
p4.title="skills";
ar.push(p1);
ar.push(p2);
ar.push(p3);
ar.push(p4);
for(var j:int=0;j<ar.length;j++)
{
ar[j].x=110;
ar[j].y=75;
ar[j].height=200;
ar[j].width=250;

}
addChild(ar[0]);
}
private function ex():void
{
i++;
if(i<ar.length)
{
addChild(ar[i]);
ar[i].visible=true;
mo1.target=ar[i];
mo1.play();
mo2.target=ar[i-1];
mo2.play();
eff.target=ar[i];
eff.play();
}
else
{
var k:int=i-1;
addChild(ar[0]);
mo1.target=ar[k];
mo1.play();
mo2.target=ar[0];
mo2.play();
eff.target=ar[k];
eff.play();
i=0;
}

}
private function end():void
{
if(i==0)
{
var t:int=i+1;
while(t<ar.length)
{
ar[t].visible=false;
t++;
}
init2();
}
else
{
removeChild(ar[i-1]);
}
}

]]>
</mx:Script>
<mx:MoveĀ  id=”mo1″ xFrom=”110″ xTo=”350″ duration=”150″>
</mx:Move>
<mx:Sequence id=”eff”>
<mx:Move xFrom=”350″ xTo=”110″ duration=”200″ effectEnd=”end()”>
</mx:Move>
</mx:Sequence>
<mx:Button x=”187″ y=”388″ label=”NEXT->” click=”ex()” />
<mx:Sequence id=”mo2″>
<mx:Move xFrom=”110″ xTo=”10″ duration=”100″>
</mx:Move>
<mx:Move xFrom=”10″ xTo=”110″ duration=”100″>
</mx:Move>
</mx:Sequence>
</mx:Application>

in this i have an array ar[] which is the array of panels

i have a count variable i which is incremented on each click of mouse button

we use the variable i as the index and move panels to front and back.

for downloading

http://www.box.net/shared/9nngn1l0tn

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.