Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




NextScene, PrevScene GotoAndStop - All Not Changing Scene



Hi All,

I am building some software for special needs children, however, I am experiencing difficulties in changing scenes. I am using FlashMX.

At the end of the first scene (named Ovals) I have tried both:

nextScene;

and

gotoAndStop("Rectangles", 1);

however, both result in the Ovals scenes repeating it's self.

Can anyone help?

Chris



FlashKit > Flash Help > Flash ActionScript
Posted on: 01-16-2004, 06:30 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

NextScene() And PrevScene()
What's up with this. Macromedia boasts, they've fixed the bug in flash 7, but it still won't work. Any thoughts?

NextScene PrevScene Issues
Hey there

There have been questions posted along this line in the past but i can't find the answer i am looking for.

I am making a flash book. Each page is a seperate scene. Each page has a forward button and a back button. The buttons are MovieClips, and I drop an instance of each into each scene.

Now, i know i can't call nextScene, prevScene from off the main timeline, so for the back button i have the following:

function onRelease():Void { _parent.previousScene(); }

...and on the first frame of the second scene (no back on the first page) on the main timeline i have declared this:

function previousScene():Void { prevScene(); }


This works on the second page (you click the button and go to page one), but on page three you will also be taken back to page one. I suppose the previous scene is taken as the one before the function definition.

If i declare previousScene on the first frame of the fist scene each button instance always takes you back to page 1. The function is always in scope on any scene.

If i copy the previousScene function to the first frame of EVERY scene (kind of missing the point of code reuse) it seems to work fine - until about page 10!? Then it doesn't work for the rest of the book.

Can anyone help me write the correct code for this? Is there a limit on how many times a scene function can be overridden or something.

Does anyone know what the hell is going on?

Thanks

PrevScene(); & NextScene(); Does Not Work
In my fla, I have 2 scenes - Begin and Grass. I have 2 buttons in a movie clip and I intend to put it in every scene. I tried using
Code:
on(release, keyPress "<Right>"){
nextScene();
}
but it does not work. What code should I use or what should I do?

[F8] NextScene() Brings Me Back To The Current Scene?
I have 3 scenes in my movie right now.

Intro , Main Movie, Text Scene..

when i use nextScene() in the Intro scene.. it brings me to Main Movie and stops just fine..

when i use nextScene() in Main Movie, it goes to Text Scene but immediately back to Main Movie..

there is a stop(); command in Text scene like all the others.. So I don't know why it won't stop on it?

Can't GotoAndStop To Certain Scene
For some reason I've always been having trouble using gotoAndStop("scene", frame#). I can only wish for luck on it. I have this button that I want to go to the main menu. It's a "Try Again" button on a game over screen and I want it to go to that scene, which is before all of the levels. (Of course.) Here's the code I've been using in the button.


Code:
on (release) {
nextScene();
}


I've also been trying:


Code:
on (release) {
_root.gotoAndStop("Main Menu", 1);
}


..and taking off the _root. Hope someone can help me. Thanks in advance.

[F8] GotoAndStop(1) For ALL Mcs In A Scene
Hi there,
I didn't find anything helpful for my problem on the board or with Google, so I decided to start a new thread...

I've got a file with two scenes. The first one is the main scene, and when the user plays around with what's in there, a lot of different MCs move from their frame 1 (empty frame, so MC is "invisible") to frame 2, 3, 4...
There are about 30 different MCs in that scene.
But the user also has the option to go to scene 2 (which is like a goodbye-animation). What I would like to happen is, that, when the user chooses to go to scene 2, all the MCs that are still open in scene 1 move to their frames 1 (otherwise they're still visible in scene 2).

There are too many MCs with all different names in scene 1, so I thought about something like

Code:
MovieClip.prototype.gotoAndStop(1);
which I put in the main timeline in scene 2.

But that doesn't work...

I've been searching the WWW for an answer for quite a while though, but nobody ever seemed to have encounterred that problem... or is is that easy that noone has to ask...? Ooops...

Cheers, Annie

GotoAndStop Next Scene
^^^
on release of a button, i want to go to scene 2, frame 1.

Gotoandstop Scene
Hi everyone, I cannot get to a different scene when i press my button. I have tried putting
_root .gotoAndStop("Framelabel")
I have tried using it in a function
btn.onRelease = function(){
gotoAndStop("sceneTwo", 1);
}; but nothing works. I know there are problems with this and it looks simple but its not. I would really appreciate any help with this.
It works if its in the same scene but that doesn't help me.
Waiting for any reply Thanks

Bethann

GotoAndStop(Scene, Frame);
Hi I am trying t do this here,
I have 2 scenes, you start out in this first one, I want a button to goto the first frame in the second scene, ive tried about everything and nothing works, please help.

on (release) {
gotoAndStop("Main", "Intro");
}

Main is the scene intro is the frame, please help.

GotoAndStop To Frame On Another Scene
Hello,

I am trying to put action script on a button instance
so that when the button is released
the user goes to the third frame in another scene
but it's not working -
nothing happens when the button is pushed
in the .swf file.

This is the code I have

code: on (release) {
gotoAndStop("Scenephoto, 3");

}

What am I doing wrong?
Is there a scene naming convention
I don't know about?
Does the code only affect one frame of the button instance?

Please help!

Thanks!

GotoAndStop(scene, Frame) In A Mc
how to use gotoAndStop(scene, frame) in a mc?
there's a button in a mc, when I click it, it will change the scene, like this:
on(release){
gotoAndStop("main_scene", 1)
}

but it doesn't work!

_root.gotoAndStop (a Scene AND A Frame?) HELP
Hi
I know this must just be a syntax thing but i just can't get it.

I have my main movie loaded into level0 it has 8 scenes.
I have a movie.swf which gets loaded into a blank MC which is in scene 2 in the movie on level0.
There is a button inside the loaded movie.swf which wants to take the user to another scene and frame of the movie in level0.

I think that the AS on the button should be:

_root.gotoAndStop ("scene2", 10)

But it doesnt work. If i take out the "scene2" part it will take me to the frame number specified, but only in the first scene.

HELP!!

'gotoandStop' To A Scene Within A Telltarget Movie ?
Hi,
I'm trying to get to a next scene from a tell target movie. The scenario is when a button is pressed a telltarget movie is played simular to a transition over the current frame 'erasing it' after which point i would like to jump to another scene. I have set a keyframe in the end of my telltarget movie clip however i can't seen to 'gotoandStop' at another scene. can anyone out there help me ?

GotoAndStop([Scene], Frame) Problems
Hello,

I have the following code in my flash program:

gotoAndStop("mainScene", 1);

When it appears within an on(release) function, it works correctly and transfers to the correct scene.

However, when it appears within a if statement it doesn't work.

Any ideas why this is?

Regards
Rob

GotoAndStop(); At Beginning Of Scene One, From Within A Movieclip.
Hello everyone,

Ok, I'm making a slideshow for a friend. I have a movie clip within the slideshow that plays for about 1300frames. At the end of the movieclip, I would like flash to return to scene 1, frame one.

on the last frame of the movieclip, I have tried using the code
Code:

gotoAndStop("Scene1", 1);

but this just starts at the beginning of the movie clip, not the flash movie.

I've also tried labelling frame one 'beginning' and used the
Code:

gotoAndStop(beginning);


but this also did not work.

Any suggestions.

Thanks

Changing Form Preloading Scene Into Main Scene.
hi all,

i've got a problem i can't figure out. i'm working on my website in flash. this is how i will do it:

http://www.auto-i-public.ch/adi/aresthetics.html

now, you see the letters cercling around in the upper left corner. all is well. now i created a preloader (there will be heavy stuff on it...maybe even shockwave files). i chose to do it with a new scene. it's a basic one. bar filling up, a few dynamic texts with the status. this is working too.
but then, when the preloading is done, it jumps into the main scene. everything appears and works. but the circeling letters don't work anymore. they run on a little loop for themselves. it's actually the only loop i have on my mainline. the rest is in mc's. i even tried to put the letters in a mc. didn't work either. it seems as the letters wouldn't initialize anymore. i checked if there are no already set variables coming over from the preloader. negative. i'm out of wisdom. if anyone could help me...i'd send the files, if nothing else helps. it's nothing really to steal.

tnx
adrian

Changing Stage Color When Changing From Scene
Hi,
I would like to change the color of my stage when I get in my next scene, is it possible?

So when people look to the movie Scene one should be black and scene 2 white. Don't tell me to put a big white square at the button of scene 2 coz when put it online I want all my window to change from color.

Thx

PrevScene() Action
I am trying to target the main movie timeline from a button within a movie clip. This works fine as long as I write the following:

on (release) {
tellTarget ("_root") {
gotoAndPlay ("Scene 1", 1);
}
}

But, I want to use the prevScene() action. When I try this, nothing happens when I click the button.

on (release) {
tellTarget ("_root") {
prevScene ();
}
}

I have found that if i take the button out of the movie clip and put it on the main timeline, then the prevScene() action works fine.
Is this a bug or am I doing something wrong?

Thanks!!
Sunny

Little Problem (prevscene)
I have this actionscript in a mc and it is not working.

on (release) {
prevScene();
}

I'v also tried

on (release) {
_root.prevScene();
}

Which didn't work either. Anyone has a quick fix or any ideas.

Thanks in advance

PrevScene(); Problem
boards got screwy... here ya go:

I have a button that has the following actionscript:

on (press) {
prevScene();
play();
}

on (keyPress"<Left>") {
prevScene();
play();
}

When the left arrow key is pressed or the button is pressed, it returns the user to the beginning of the movie (scene 1). This happens no matter what scene you are in (there are around 12 scenes).

Thanks in advance for any help that can be provided.

PrevScene() Problem
I have a button that simply calls prevScene(). When the button is pressed, regardless of the scene you are in, it takes you to the beginning of scene 1.

Has anyone even HEARD of a problem like this? Am I using the function incorrectly? Is there another way for me to make a button that goes to the previous scene? Any ideas, please.

Thanks in advance for any help.

Problems With My As On PrevScene, Please Help
I have various movies clip within a movie and my back (mc = arr2_mc) and next (mc = arr1_mc) buttons are on the main scene.

This is on my main scene on a first frame

ActionScript Code:





movieclip.prototype.playBackwards = function(arg){
if(arguments.length>0) {
this.onEnterFrame= undefined;
this.play();
} else {
this.onEnterFrame = function() {
this._currentframe == 1 ? this.gotoAndStop(this.nextFrame) : this.prevFrame();
}
}
}
arr1_mc.onRelease = function() {
mc1.playBackwards(false);
}
arr2_mc.onRelease = function() {
mc1.playBackwards();
}





when it goes back, it goes back frame by frame without stopping but I want it to go only to previous Scene. instead of going to previous frame.

Do i have to create a unique button? which i did but i didn't work?
please help help help help... i'm stuck

please help.

thank you!!

[F8] Nextscene() = GotoAndPlay("nextscene",1) ?
I'm making a movie with an intro scene that people can skip by pressing a button. The button is coded with on (release) {nextScene();} and the action for the last frame of the movie is gotoAndPlay("scene2", 1);.

The first frame of scene 2 has some text that should show up by default that changes when you click other buttons. The actions for the first frame contains the following code:

hideLeftTextArea(); //referencing a function to hide all the text boxes
defaultText._visible=true; //shows the default text

The problem is that when you skip the intro by pressing the button the default text shows up as it should, but when the intro runs its natural course it disappears.

I've solved the problem by using nextScene(); for the last frame of the movie, but I'm curious why that way works while the other doesn't. Any ideas?

GotoAndStop("Scene", 1) Within IF Statement & OnEnterFrame
Hello,

How do you get the gotoAndStop("Scene", 1) method to run in an IF statement within an onEnterFrame method?

Regards
Rob

Changing From Scene 1 To Scene 2
im on scene 1, and i made a button which i want so when i click it, on release it will switch the whole flash movie to scene 2

what code do i need for this?
ive tried

on (release) {
gotoAndPlay ("Scene 2");
}

but that doesn't seem to work





























Edited: 04/24/2008 at 02:55:13 AM by reborm

Changing Scene Help
I'm using gotoAndPlay(scene, frame), with the appropriate scene and frame arguments, but nothing happens. I now that the function that executes this statement is being called with the correct arguments because I see the values when I trace them. I'm using Flash 5. Any clues?

Thanks

nepzap2

Changing Scene In MC
ok i have a MC box and i want to change the scene with a button external to the MC content, this is what i have

on(release) {
images_mc.gotoAndPlay(nextScene());
}

its obviously wrong, anyone know how to make it work?

Changing Scene ?
I have a Play button. I want when the users press on this button my animation turns to another animating scene.

In my Timeline if I do normally for the other animating scene this scene will be played despite the users press the button or not.

So how can I like stop some layers from playing until a button is pressed/an event occurs ?

Thanks.

Changing The Name Of A Scene
Do you know how to rename a scene?
I tried to double-click on the scene name but there is no response from the program. Please help.

Help Changing Scene With MC
I am trying to change from scene 1 to scene 2, but it is not working.

I have a mc on scene 1. I have the following code associated with that mc:

on (release) {gotoAndPlay("Scene 2", 1);

}

I also have a stop at the first frame of scene 1. There is only one frame in scene 1 with the mc in that frame.

If I run the file, when I click on the mc, nothing happens. I can select Play and the scene advances to scene 2.

In scene 2, I have a mc with the following code, that does work:

on (release) {gotoAndPlay("Scene 1", 1);

}

What must I do to get the scene 1 to advance to scene 2 after clicking the movie clip?

Thanks,
David

Changing To A New Scene
Currently, I am working through Flash MX 2004, and I have made a couple animations. I see lots of flash movies where such animations are linked together, and I thought I'd download a couple open source ones, to see if I could figure out what they are doing. I couldn't. It looks like its just one of the scenes when I open the file, yet when I run the movie, it still works with all the scenes! So that didn't really help me. How do you make a few movies and link them together, or at least, change scenes?

Scene Changing
OK what i want is..

Say i have a Gallery button on my menu and I'm currently on my homepage.

When I press it it'll remove the bottom part of the page (which is the movie .swf clip being played for tht page)

then it loads a different .swf clip which is the actual gallery.

Basically I'm tryin to describe going to a different place wivout changin the webpage or removing the top part of the page containing the menu and logo movie clips

Any idea how?

Scene Isn't Changing :(
Hi, I just started learning AS'ing and have been trying to program an interactive MC. I've come across a problem where the scene is not changing when my character hits a hotspot.


Code:
if (this.hitTest(_root.hotspot)) {
gotoAndPlay("Main",1)
}
Any help is appreciated. Thanks!

Note: If the whole script is needed, i can post that up later. Thanks again

Zayxic

Changing Scene?
Hi,
I know this might be a bit basic, but i have never done this before...

i'm having troubles changing scene on Flash mx, whenever i click the button it goes to scene 2, and then back to scene 1 and repeats over and over again

can anyone tell me the correct action script i should be using ... or give me a link to any tutorial that explain how to do this....

Thanks

Changing Scene From Within A Movieclip
I have a menu button inside of a drop down menu movieclip and no matter what I try, I can't make the button change the scene. I am just trying to make a simple drop down menu type navigation site and I can't even get it to go to the next page. I feel like I am dummer by the minute. Help before it is too late.

Help With Changing Scene From Nested MC's
Here's the setup. On the main timeline there is a MC (MC1)inside of MC1 there is another MC (MC2)and actions to control MC2. Inside of MC2 are 6 buttons, the navigation for the site. My question is how do I make these buttons change the scene of the main timeline? I tried using the following scripts suggested to me by others but neither worked.

on (release){
_parent._parent.gotoAndPlay ("Fash Portfolio", 5);
}

and

on (release){
_root.gotoAndPlay ("Fash Portfolio", 5);
}

need some help here. thanks

I Have A Changing Scene Question. Help
Flash 5

Here is what I have. My first scene( 10 layers total ) includes text, motion and shape tweens, and a button which I have assigned a goto scene two action. However, I want every thing on my first scene to fade into the background as my second scene is being created. I quess you would call my first sceen the preload? I don't really understand how I need to do this. If it was just one layer, then I think I could figure it out , but it's mutil layer with different thing happening at different times. I'm very new to flash but very interested, so if I am not very clear, please correct me.

Changing Scene Is Not So Easy
How can i do to change from one scene to other? I have a graphic (called groupindex) composed by 3 buttons (called index1, index2, index3) inside a movie clip (called openmenu). The movie clip is placed in the 3 scenes of the flash movie. I wrote this code for the buttons (for example to change to scene3) but it does not work:
on (release) {
_root.gotoAndPlay("Scene3", 1);
}
Obviously, it's easy to do this when you have the button in your scene but it´s not so easy when the button is inside a movie clip in the scene.
The hierarchy for any scene is:
scene - openmenu - groupindex - index1
scene - openmenu - groupindex - index2
scene - openmenu - groupindex - index3

Can you help me?

Navigation 'scene Changing'
Greetings.

Fairly new to Flash MX, but reading lots of books. Just wanted some advice on an issue.

I am trying to duplicate the interface at http://www.davidsonco.com. What I am trying to figure out is this:

Press a button, then have the current content fade before the new content appears. How do you get the current content to fade, then go to the new content? I'm sure it is something simple. (For example, on the Davidson website, click CONTACT, the current content fades, then the header changes, then the contact info appears.)

Thanks!

Changing Mc In Unvisited Scene
do something in other scene
Hi there,

I've got this mc in two scenes (an intro and the final scene).
When the close-button in the intro is clicked, I don't want to show the mc in the final scene...
when using variables there's a little bump in it, so I want to be able to set the visibility of the mc in the other scene to zero, before reaching that scene.

Is that possible?
won't work with


_root.welcome2.visible=false;


r bin

Changing Scene From A Menu?
Sad thing to say, but i'm stock in a stupid little thing.

I have made a little menu with some buttons.

this is my main navigation bar.

on the buttons i have made the code:

on (rollOver) {
gotoAndPlay("anim");
}
on (press) {
gotoAndStop("scene2", "matrix");
}

basicly i want to play a little sequence within the movie (menu)
on rollover...that works fine, but when i press the buttons i want the scene to change....but it dosent change the scene???
why??? is it because its a "_root" problem...

Please help :-)
i thought the problem could be because it only wants to change with in the movie menu.

thanks Mirrorman

Changing Scene Prob
i want my movie to change scene when rollover, but it didnt change scene and play the same scene again .


Code:
on (rollOver) {
gotoAndPlay("home_reload", 1);
}

Changing Scene Order
I am putting together a movie and I need to swap the order of scene 1 and scene 2. It there a simeple way to do this?

Also, in searching for other posts about this I came across one in which the recommend not using scenes for the web, should I look into a different way of making this movie? Thanks!

Changing Scene From Level1
Hi guys,

Problem here - for some reason, I'm unable to change the scene with a button that's nested 1 layer deep inside a movieclip. I have buttons it the root that are doing the exact same thing and are working just fine.

This is the very simple code that I'm using on the button:

on (release) {
_root.gotoAndPlay("1-intro", 1);
}

This seems like such a simple task - not sure why I'm having such a problem with it.

Anyone have any ideas?

Thanks guys!

Please Help... Although It's Very Easy (scene Changing)
hi everyone,
i got this problem of cant get to the scene i wanted it to go...

situation:
i had a button in the movie and the button i put in the script

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

// Graphics is the name of the scene

but everytime i test the movie, it return to the current movie, frame 1...

please help cause i'm really stuck... thks

External SWF And Scene Changing
Hello,

I am loading an external .SWF file into my movie. The external SWF file has 3 scenes, each scene has a music track. In my main movie I have an audio player. How do I perform the nextScene/prevScene commands that will link to my external .SWF file and change the scenes to another audio track?

Any idea what the action script for this is?

Thanks!

Scene Changing Problems
I have this code in the onClipEvent (enterFrame) event of one of my movie clips


ActionScript Code:
_level0.timer.text = "Time remaining: " + int(timeLeft - 0.5);
   
    if (timeLeft <= 0) {
        //nextScene();
        gotoAndPlay("endScene",1);
        if (int(timeLeft) == int(timeLeft - 0.5)){  // to check the if statement is
            _level0.timer.text = "debug text";  // working make timer text flash
        }
    }
Can I not change scene from code embedded in a movie clip? - this certainly doesn't work - the 'debug text' test works... the timer falshes between minus however-many seconds and "debug text" , so I know the code is being executed, but neither nextScene() or gotoAndPlay() will allow me to go to the next scene when the timer hits zero!

Thanks for your help,

M

Changing Scene And Go To Frame
I´m having troubles with a game i´ve made. When the game is finished the movie is in scene 3, then I want to press a button on the keyboard and the movie should go to scene 1, frame 400. How to?

I´ve tried:


ActionScript Code:
on (keyPress "a") {    gotoAndStop("Scene 1", 400);}


but it doesn´t work, the stuff on scene 3 is still visible when I press the button, and the stuff on scene 1 just shows for a short moment. weird.

so, please help!

Changing Scene And Go To Frame
I´m having troubles with a game i´ve made. When the game is finished the movie is in scene 3, then I want to press a button on the keyboard and the movie should go to scene 1, frame 400. How to?

I´ve tried:


ActionScript Code:
on (keyPress "a") {    gotoAndStop("Scene 1", 400);}


but it doesn´t work, the stuff on scene 3 is still visible when I press the button, and the stuff on scene 1 just shows for a short moment. weird.

so, please help!

Copyright © 2005-08 www.BigResource.com, All rights reserved