AS3: going to specific frame label

i tried to specify a mouse click button for specific frame label.
the idea is:
when click a button for example 2, the play head plays from 31 to 45.
from there is jumps to the stored string witch is the name of the label

i get this error when i compile:
ArgumentError: Error #2109: Frame label root1 not found in scene Scene 1.
      at flash.display::MovieClip/gotoAndPlay()
      at main_fla::MainTimeline/frame45()
it says, there is no labels, but the label is there.

any help, thanks

// this code on frame 30
stop();
 
var nextSection:String = "";
 
section1.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
section2.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
section3.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
 
function navigate(evt:MouseEvent):void {
	addEventListener(Event.ENTER_FRAME, frameSection, false, 0, true);
	play();
}
 
function frameSection(evt:Event):void {
	if (currentFrame == 45) {
		nextSection = evt.target.name;
	}
}
 
//-----------------------------------------------
//this code on frame 45
 
gotoAndPlay(nextSection);

Open in new window

main.txt
LVL 6
MadkhaliAsked:
Who is Participating?
 
flashmexConnect With a Mentor Commented:
if you want to jump on a frame using frame label
you can use this

gotoAndStop("your frame lablel");
0
 
MadkhaliAuthor Commented:
thanks for your help
i achieved the points you talked about

my point is different, i need to to jump to stored label in the variable.

the file is the first post, i use flash CS3

Thanks again
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.