PDA

View Full Version : Difficulty Changing Scenes with gotoAndPlay();


Goosey
02-08-2003, 06:07 AM
I am trying to create a flash game which involves a large number of scenes (9 to be exact). The first scene has a loader, then moves to the main menu where you can choose to read the story (go to next scene, named "Pre-Story"), or go strait to the combat (which is a scene named "grendel").

I created a movieclip on the menu frame of the first scene (which btw is named "Opening") and included in it this code:


on (release) {
trace("Pre-Story");
gotoAndPlay("Pre-Story", 1);
}


The problem is that although I know the movieclip is registering the release (because the trace is passing through) the movie simply wont gotoAndPlay the next scene.

I have tried a number of things, including:
-Replacing gotoAndPlay("Pre-Story", 1); with _root.gotoAndPlay("Pre-Story", 1);
-Changing the name of the scene to "prestory" and also changing the gotoAndPlay respectively (thought the "-" might have been a problem.
-Naming frame 1 of "Pre-Story" and having it point at the name.

None of those remedies worked... So does anyone have any suggestions?

I have uploaded the *.fla to:
http://goosey.hatesit.com/beowulf.fla

please someone help me asap I need to get this game done in a week for an english project :(

binkyboo
02-08-2003, 06:41 AM
on (release) {
trace("Pre-Story");
//you need to target the main timeline first with _root and then go to and play.
_root.gotoAndPlay("Pre-Story", 1);
}

Goosey
02-08-2003, 06:55 AM
Although I appreciate the reply binkyboo I do wish you had read my entire post..

I have already tried that solution (and it was not the solution) :(

btw- Just to doublecheck I went and tried it again after reading your reply and it still did not function as intended.


edit: some more things I just tried which didn't work:

-Putting the code in a button rather then a movieclip
-Putting the code in a button inside the movieclip
-Begging my computer to just do what I want it to do and promising to defrag it if it would just behave... it loves defrags..

binkyboo
02-08-2003, 07:46 AM
I'm sorry I didn't read your entire post. You'll have to forgive me, it's late. Anyways, target a frame label not the scene name and it'll work. I've attached a file. The top button is just a button. The second button is a button embedded in a movieclip. The third button is a movieclip. All three go to the second scene.

Goosey
02-08-2003, 06:57 PM
wow binkyboo that worked.

Some odd things I noticed: If i put a button at _root level then the button will be able to target a scene (as in gotoAndPlay("Scene", framenum); ) with no problem.

However if the code is done from a movieclip or from a button nested inside a movieclip then I had to target the frame name for it to work.

So what we get is if movieclips are involved you basically are doing gotoAndPlay("Framename", "framename");

Now there comes a possible problem in the fact that two frames in different scenes can have the same label.

And the command is SUPPOSED to work as gotoAndPlay("SCENE", framenum); isnt it?

Its very odd indeed don't you think? Bug I suppose?

CyanBlue
02-08-2003, 10:21 PM
Howdy... :)

All you have said is the reason why people should avoid using 'Scene' with gotoAndPlay() or gotoAndStop() function...

According to the Flash manual, there are two types of gotoAndPlay() function in Flash...

gotoAndPlay(scene, frame)
myMovieClip.gotoAndPlay(frame)

Do you see the difference??? First one accepts two arguments and the second one gets only one...

So, to make things working on all cases, you will have to use 'FRAME LABEL'... Know what I mean???

Oh, by the way... You are not supposed to have multiple frame labels with the same value... That's not a good idea at all...

Hopefully I have cleared some of your questions??? :)

doorock42
02-09-2007, 05:48 PM
I'm using scenes and gotoandplay (don't laugh) and there's some strange stuff happening.

Scenes 1 and 2 all work fine with the gotoandplay("scenename", framenumber);

Scene 3 has 17 menu buttons that use gotoandplay with scene names. Buttons 1-11 work fine. Buttons 12-17 do not. Also, within each scene (from scene 4 through scene 20), they all have a "next page" button that has NEVER worked.

I'm going back and converting all these to movieclips and using gotoandstop with frame numbers (since each scene is a single frame long), but I've already made all of these scenes and it would be a lot quicker if I could figure out why it wasn't working.

Interestingly, I put a trace on my buttons and it returns that I've properly hit the button. It's just not going.

A similar problem kept happening with one of my pages that had video on it -- the video would pop up and work right, but whenever I added a close box to the video_mc, it would cease popping up. I eventually gave up on the popup thing and just made another scene.

Any help you all could provide would be greatly appreciated.