[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3425
  • Last Modified:

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
0
Madkhali
Asked:
Madkhali
1 Solution
 
flashmexCommented:
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now