00:00
00:00
Newgrounds Background Image Theme

DashXero just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

some sort of if statement

474 Views | 5 Replies
New Topic Respond to this Topic

some sort of if statement 2006-08-11 02:14:08


ok its probabli kinda complicated to explain but does anyone know actionscript for a button like
on (release) {
if frame = 10
gotoAndStop(..) if else gotoAndStop(..)
}

Response to some sort of if statement 2006-08-11 02:21:54


for a button the AS is

on(release) {
//stuff happens
}

or

on(press) {
//stuff happens
}

Since you had gotoAndStop(..) I'm assuming you want the button to make a movieClip goto and stop on a certain frame, so the as would be something like:

on(release) {
_root.movieclipname.gotoAndStop(5);
//replace movieclipname with the movieclipname and 5 with whatever frame number you want it to stop on.
}


BBS Signature

Response to some sort of if statement 2006-08-11 02:23:46


At 8/11/06 02:14 AM, Zeramas wrote: ok its probabli kinda complicated to explain but does anyone know actionscript for a button like
on (release) {
if frame = 10
gotoAndStop(..) if else gotoAndStop(..)
}

on(release){
this._currentframe == 10 ? gotoAndStop(frame if true) : gotoAndStop(frame if false);
}

if you don't like conditionals, then use this code, but I suggest using the first method.

on(release){
if(this._currentframe == 10){
gotoAndStop(...);
}
else {
gotoAndStop(...);
}

Response to some sort of if statement 2006-08-11 02:25:15


yea but i want like the if statement in
like a basic soccer shotout and and goalie is a mc and goes to a rondom frame when u click and if u click the top left and the goalie goes there on one of the frames they wuld
colide and if he dived the other way it wuld go in

Response to some sort of if statement 2006-08-11 02:27:05


yea thanx

Response to some sort of if statement 2006-08-11 02:27:46


on(release) {
if(goalie._currentFrame == 5) {
gotoAndPlay("score");
} else if (goalie._currentFrame == 10) {
gotoAndPlay("block");
}
}

Like that?


BBS Signature