Link to home
Start Free TrialLog in
Avatar of hayeahright21
hayeahright21

asked on

Switching between scenes using buttons...not working?

I have divided the content of the six sections of my movie into six scenes.  They all share the same basic layout including the navigation bar I would like used to switch between areas or scenes.  The common elements of that layout are grouped together as a symbol, and separate instances of that symbol appear in each of the six sections.

I am trying to get the buttons to navigate between scenes.  I've followed the instructions in the help file and as I've seen on this site.  I edit the symbol that contains the buttons, and set each button so it has a variation of this attached:

on (release) {
      gotoAndPlay("Home", 1);
}

where Home is whatever the name of the scene is.  I have also tried this using _root.gotoAndPlay.  As well, I've tried elevating the buttons from inside the common layout element symbol so they're their own instances within the scene.

When I test the movie, the buttons don't appear to work.  But here's the bizzarre thing--immediately after opening the document or reverting it, if i then double click on the symbol instance to edit it, then turn on simple buttons, then click one of the buttons, it works.  But only once, then it quits working again.  Somehow after that happens all the actionscript assigned to the buttons just dissappears.

I am totally baffled, and I'm hoping someone out there has encountered this before.  Thanks in advance for the help.
Avatar of blue-genie
blue-genie
Flag of South Africa image

Hi there.
Assuming you're using MX,
your code is right, so I can only assume it's something really minor that you've overlooked.

You're duplicating  your grouped navigation in each scene, I can only suggest you check carefully
1. Names of each scene - remember they are case sensitive, use your scene inspector.
2. Check the code on your buttons that they are right for each scene
3. Do you get any errors in the output window when running your movie.
ASKER CERTIFIED SOLUTION
Avatar of rexmor
rexmor
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
on (release){
tellTarget(_root){
gotoAndPlay("target_scene");
}
}


rexmor
Avatar of hayeahright21
hayeahright21

ASKER

There's one very important trick I've learned when trying to speak a foreign language: if you don't know the exact word for something, talk around it.  That's basically my solution to this problem: instead of having the button contain the command to go to a specific scene, it had this little bit attached to it:

on (press) {
    _root.DJButton.onRelease = function() {
        gotoAndPlay(3);
    };
}

Where "3" is a frame in the root movie and the same scene that contains the action telling the thing to go to the scene the button is intended to take you to.  So basically I did two steps to do one thing, but it worked.  Looking at rexmor's answer, though, I think that if I'd been patient enough to wait for it, it would have worked.  Seems like the prob relates to the button being embedded in a movie clip.

Thanks all for the help.

-= jonathan =-
question. Building on this... I have a preloader and basically 2 frames in SCENE 1 (root). I have 1 frame with preloader, and frame 2 has the main movie. The 2 frame has "scene 2" and in this scene, I need to be able to link to "Clan Info" which is the instance name of some frames. Anyways, instead of _root, what do I do??
I got
"
on (release) {
tellTarget("_level1.Symbol 2"){
gotoAndPlay("ClanInfo");
}
}
"
But that doesn't work :(