Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple if/else problem (I hope!) 1

Status
Not open for further replies.

Gerb

Technical User
Jan 8, 2002
6
GB
Hi,

Just getting to grips with this actionscript malarky, but I can't work out how to do this:

I have a button on frame 5 which, when clicked makes the movie jump to frame 10 and fade in something else. However, if the movie is already at frame 10 the button can still be clicked on, and the fade occurs again unecessarily if someone clicks it. Is there any way to disable the button from working if the current frame is the frame the button points to?

I think it's an If / else script required along these lines:

on (press)
if (currentFrame =10)
stop;

else
on (release)
gotoAndPlay (10)

Any help would be greatly appreciated :)
 
What about putting it a little more succinctly:

on (release){
if (_root._currentFrame != 10){
gotoAndPlay(10);
}
}

You don't have to worry about providing an ELSE statement, because if the IF statment is resolved as FALSE none of the statements within the block will execute, meaning that the button is pretty much unusable in frame 10.

Neat, huh?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top