Sign in to follow this  

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

This topic is 3772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

This topic is 3772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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