PDA

View Full Version : gotoAndPlay - errors!



UserName++
May 2nd, 2006, 07:11 AM
before you all shout - i am new to this so be gentle...

I have a variable set in my code navigationNum and what i want to do is gotoAndPlay a scene of that number.

So for example with out the variable name it would be:

_root.gotoAndPlay("1");

what i want to do and cant figure out is

_root.gotoAndPlay(navigationNum); but for it to go to "1".

It might seam really basic but i am struggling :(

Sorry wrong area i have posted in right one now :D

Mirandir
May 2nd, 2006, 07:35 AM
Well you cannot use a variable to jump to scenename. Thats just not possible since Scenes only exist while editing the movie.

What you need to do is use framelabels.

1.) Create a new layer. Give it a suitable name. I usually call the layer --- labels

2.) Make a keyframe at the frame you wish to target by a "goto", if it isn't the first frame.

3.) Select the keyframe i the timeline and open the properties panel.

4.) Find the textfield labeled "frame" (It should be topleft in the properties panel). Enter a suitable labelname here. Avoid using numbers only labels to avoid conflict with the framenumbers. In your case you need to use a sequential naming convention so that you can use the navigationNum variable.

E.g: you can name the labels scene1, scene2, [b]scene3[b] ... and so on. then you can make your "goto" look like this:


_root.gotoAndPlay("scene" + navigationNum);


/Mirandir