Sign in to follow this  
Ildun

[web] Flash: How I can go back 1st frame when i'm not pressing a key?

Recommended Posts

Let say I has a movie clip which has 3 frames: 1) 1st frame is Idle, instance name: Idle ( in movie clip i put stop(); ) 2) 2nd frame is move left animation, instance name: moveLeft 3) 3rd frame is move right animation, instance name: moveRight My codes are as follow: onClipEvent ( keyDown ) { if ( key.isDown ( Key.LEFT ) { gotoAndStop ( "moveLeft" ); } if ( key.isDown ( Key.RIGHT ) { gotoAndStop ( "moveRIGHT" ); } } But, how can I go back "Idle" frame when i'm not pressing left or right key??

Share this post


Link to post
Share on other sites
I've only used AS3 but can't you do this:


onClipEvent ( keyDown )
{
if ( key.isDown ( Key.LEFT )
{
gotoAndStop ( "moveLeft" );
}
else if ( key.isDown ( Key.RIGHT )
{
gotoAndStop ( "moveRIGHT" );
}
else{
gotoAndStop("idle");
}
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this