Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-08-2003, 06:07 AM   #1
Goosey
The Greatest Goose
 
Goosey's Avatar
 
Join Date: Feb 2003
Location: Ohio
Posts: 24
Send a message via ICQ to Goosey Send a message via AIM to Goosey
Default Difficulty Changing Scenes with gotoAndPlay();

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:

Quote:
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
Goosey is offline   Reply With Quote
Old 02-08-2003, 06:41 AM   #2
binkyboo
Senior Member
 
binkyboo's Avatar
 
Join Date: Mar 2002
Location: Madison, Wisconsin
Posts: 1,312
Send a message via MSN to binkyboo
Default

ActionScript Code:
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); }
binkyboo is offline   Reply With Quote
Old 02-08-2003, 06:55 AM   #3
Goosey
The Greatest Goose
 
Goosey's Avatar
 
Join Date: Feb 2003
Location: Ohio
Posts: 24
Send a message via ICQ to Goosey Send a message via AIM to Goosey
Default

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..

Last edited by Goosey; 02-08-2003 at 07:20 AM.
Goosey is offline   Reply With Quote
Old 02-08-2003, 07:46 AM   #4
binkyboo
Senior Member
 
binkyboo's Avatar
 
Join Date: Mar 2002
Location: Madison, Wisconsin
Posts: 1,312
Send a message via MSN to binkyboo
Default

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.
Attached Files
File Type: zip test_2.zip (3.1 KB, 7862 views)
binkyboo is offline   Reply With Quote
Old 02-08-2003, 06:57 PM   #5
Goosey
The Greatest Goose
 
Goosey's Avatar
 
Join Date: Feb 2003
Location: Ohio
Posts: 24
Send a message via ICQ to Goosey Send a message via AIM to Goosey
Default

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?
Goosey is offline   Reply With Quote
Old 02-08-2003, 10:21 PM   #6
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

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???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 02-09-2007, 05:48 PM   #7
doorock42
Registered User
 
Join Date: Feb 2007
Posts: 1
Default so here's something weird

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.
doorock42 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:43 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.