PDA

View Full Version : Simple "if that is this then go there" question


mattshawuk
10-12-2007, 11:04 AM
Well I've just started using AS3, and I wasn't that great with AS2, and already I'm stumped with a really simple problem:

I've got a dynamic text box called "trigOne" that is either displaying "yes" or "no". (this occurs after an input from an external controller reaches a certain value...) I also have a movie clip called "clack".

All I want to happen is when "trigOne" says "yes" , for "clack" to go to a frame called "thirty".

I would have thought that:

Code:

if(Stage.trigOne.text=="yes"){ Stage.clack.gotoAndPlay("thirty"); }


would work... but no, nothing happens. I would like to keep the code relatively simple, as there are a few trig text boxes that are all yes or no that will do certain things if various combinations are activated.

Thanks for any help, this is killing me

Matt

Qutaibah
10-12-2007, 02:54 PM
assuming your code is on the main timeline, and Clack is a movieClip already sitting on the stage:

change "Stage" to "this"
I think this should work

stompwampa
10-12-2007, 03:31 PM
if (this.trigOne.text == "yes")
{
this.clack.gotoAndPlay(30);
}