wipe in wipe out effects to panels


<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”init()” >
<mx:Script>
<![CDATA[
import mx.containers.Panel;
import mx.controls.Alert;
public var pa:Array=new Array();
public var count:int=0;
private function pac():void
{
for(var i:int=0;i<pa.length;i++)
{
pa[i].x=215;
pa[i].y=65;
pa[i].width=216;
pa[i].height=200;

}
}
private function init():void
{
var p1:Panel=new Panel();
p1.title=”personal”;
pa.push(p1);
var p2:Panel=new Panel();
p2.title=”contact”;
pa.push(p2);
var p3:Panel=new Panel();
p3.title=”qualification”;
pa.push(p3);
var p4:Panel=new Panel();
p4.title=”skills”;
pa.push(p4);
pac();
addChild(p1);
trace(pa);
}
private function nex():void
{
count++
if(count<pa.length)
{
re1.target=pa[count-1];
re1.play();
}
else
{
re1.target=pa[pa.length-1];
re1.play();

}
}
private function en1():void
{
if(count<pa.length)
{
pa[count].width=0;
addChild(pa[count]);
removeChild(pa[count-1]);
re2.target=pa[count];
re2.play();
}
else
{
count=0;
removeChild(pa[pa.length-1]);
addChild(pa[count]);
pac();
trace(pa);
}

}
]]>
</mx:Script>
<mx:Resize id=”re1″ widthTo=”0″ duration=”1000″ effectEnd=”en1()”>
</mx:Resize>
<mx:Resize id=”re2″ widthTo=”200″ duration=”1000″>
</mx:Resize>
<mx:Button x=”224″ y=”303″ label=”next” click=”nex()” />
</mx:Application>

in this i have an arrayof panels ‘pa’ aand i have used the mouse click event counter “count” as the index in to the array .

to the first element  in the array i have applied the resize effetwhich resizes it to width ’0′ then i have removed the panelfrom the display.

next i added the next element on the stage with width=0 then i resized to widt=200.

finally when the count reaches the length of the array it is reset to zero so again the first panel element in the array is loaded.

for downloading the swf file:

http://www.box.net/shared/lvcbtnxx38

  1. July 11, 2010 at 5:33 pm | #1

    Your blog is good. use images or videos, it will better learn.

  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.