PDA

View Full Version : Quick Question about .gotoAndPlay


LiquidIce
10-24-2002, 09:25 PM
I'm having some trouble, i'm probably just overtired and overlooking something simple, but I have this code:

var thispoof = "poof" + p
thispoof.gotoAndPlay(2);

now when i run it I would assume that it would run the code as:

poof1.gotoAndPlay(2);

(assuming p = 1 elsewhere in the script)

This is not the case and i can't get it to start playing the second frame of the 'poof1' movie clip. Anyone have any ideas?

If it makes a difference poof1 is created by duplicating the original poof movie clip. all frames, and scripts should get duplicated along with it, right?

Thanks!
-Vin

CyanBlue
10-24-2002, 09:31 PM
Howdy... :)

If that movieclip is on the main timeline, you could try this...

_root["poof" + p].gotoAndPlay(2);

Or if it is under other movieclips, just adjust the path for it...

Try to look up the eval() function in the dictionary too...

Good luck... :)

tiger
10-24-2002, 10:50 PM
i may be wrong but dont you need a dot after this

this.poof

CyanBlue
10-24-2002, 10:56 PM
Howdy, tiger... :)

I think LiquidIce created a variable named 'thispoof' in his/her code since he mentioned this in his post...

var thispoof = "poof" + p

LiquidIce
10-24-2002, 11:20 PM
Thanks CyanBlue, it worked. Although, i still don't understand why....

_root["poof" + p].gotoAndPlay(2);

would make it _rootpoof1.gotoAndPlay(2);

why don't you need the . after _root?

You would think that it should be _root.poof1.gotoAndPlay(2);

Do the braces automatically add the period or something?

-Vin

CyanBlue
10-24-2002, 11:28 PM
Howdy...

I'll be just brief...

'[' in Flash is the symbol you use with the array, right???

Think it this way... _root["poof" + p] meaning the array item within the _root scope that has the name value of "poof" + p.
And you don't remember using '.' when you use an array in Flash, right??? That is the reason... :)