Skip to main content
Participating Frequently
January 10, 2008
Question

action script for scene navigation

  • January 10, 2008
  • 5 replies
  • 815 views
i am new to flash and i am trying to write action script that will enable buttons to navigate between multiple scenes.
This topic has been closed for replies.

5 replies

Participant
January 15, 2008
Hi, I need some help with actionscript for making a button go back to previoius scenes.
(ex. Current scene = 8, want to go back to scene 3)
your help is greatly appreciated. thx
Inspiring
January 15, 2008
quote:

Originally posted by: maiiru_rukia
Hi, I need some help with actionscript for making a button go back to previoius scenes.
(ex. Current scene = 8, want to go back to scene 3)
your help is greatly appreciated. thx

Hi, same offer: if you want to send your email address by private msg, I'll send you a working example. That should clear up any confusions about moving between scenes.
Inspiring
January 14, 2008
if you send your email address via Private Msg here, then I'll mail to you a working fla that does what we're discussing
Inspiring
January 14, 2008
> gotoAndPlay("1","Scene 1");

Hi. Are you sure that you don't want (1, "Scene 1") ? I.e., if you haven't assigned a label of "1" to a frame (which would be confusing)

also, if you are testing a scene with Ctrl-Alt-Enter, then you can't jump between scenes, IIRC. You'd instead get an error on the standard output.

but you can have the button navigate to a different scene if you've tested with Ctrl-Enter (i.e., the whole movie)
technodonAuthor
Participating Frequently
January 14, 2008
i always test control enter for the entire movie. i have not gotten any errors. i tried removing the "" from the frame with same outcome. as well as creating a layer on each scene and labeling it, still does not seem to work.
technodonAuthor
Participating Frequently
January 11, 2008
this is what i have so far and this is the error i keep getting
function onBtn1Click(evt:MouseEvent):void {
gotoAndPlay("about,scene1");
}
btn1.addEventListener(MouseEvent.CLICK, onBtn1Click);

function onBtn2Click(evt:MouseEvent):void {
gotoAndPlay("drawings,scene2");
}
btn2.addEventListener(MouseEvent.CLICK, onBtn2Click);



ArgumentError: Error #2109: Frame label drawings,scene2 not found in scene scene1.
at flash.display::MovieClip/gotoAndPlay()
at donlisy_fla::MainTimeline/onBtn2Click()
Inspiring
January 11, 2008
quote:

Originally posted by: technodon

gotoAndPlay( "drawings,scene2");

ArgumentError: Error #2109: Frame label drawings,scene2 not found in scene scene1.




gotoAndPlay( "drawings", "scene2");
technodonAuthor
Participating Frequently
January 14, 2008
i tried to simplify my problem my using component buttons with 4 ,single frame ,scenes and when i test the movie i can navigate to only one scene. i also tried to do this in a single scene movie and the code works great. the only difference in the code is the addition of the scene name. what could i be missing?

stop();

function onBtn1Click(evt:MouseEvent):void {
gotoAndPlay("1","Scene 1");
}
btn1.addEventListener(MouseEvent.CLICK, onBtn1Click);

function onBtn2Click(evt:MouseEvent):void {
gotoAndPlay("1","Scene 2");
}
btn2.addEventListener(MouseEvent.CLICK, onBtn2Click);

function onBtn3Click(evt:MouseEvent):void {
gotoAndPlay("1","Scene 3");
}
btn3.addEventListener(MouseEvent.CLICK, onBtn3Click);

function onBtn4Click(evt:MouseEvent):void {
gotoAndPlay("1","Scene 4");
}
btn4.addEventListener(MouseEvent.CLICK,onBtn4Click);
Inspiring
January 11, 2008
gotoAndPlay(frame, scene) will work