Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-08-2009, 07:56 PM   #1
ImOnCloudNine69
Registered User
 
Join Date: Jan 2009
Posts: 5
Default [AS2] gotoAndStop problem

I have a shooting game, and im trying to make a pause menu. well when i hit ESCAPE i have it go to another frame, which works just fine, the problem is my ship/bullets/enemies if they are on the screen, are still visible and do not stop playing when im on the pause frame. they are all MC's and all move with actionscript. it just loops on one frame for the entire game movement and play. simple stuff.

FRAME 2 (the game frame, 1 is my start menu)
ActionScript Code:
if (Key.isDown(Key.ESCAPE)){        stop();     _root.gotoAndStop(3);   }

FRAME 3 (the pause menu)
ActionScript Code:
stop(); keyListener = new Object(); keyListener.onKeyDown = function (){   if (Key.isDown(Key.ESCAPE)){      _root.gotoAndStop(2);   } }; Key.addListener(keyListener);
ImOnCloudNine69 is offline   Reply With Quote
Old 04-08-2009, 08:04 PM   #2
gordeaoux
Senior Member
 
Join Date: Sep 2007
Posts: 100
Default

It sounds like you'll need to explicitly stop the movement of the ship/bullets/enemies in your actionscript. How are you moving the stuff around? Is it in an onEnterFrame handler? If so, you could try putting an empty onEnterFrame section on frame 3, as in:

Quote:
onEnterFrame = function(){
}
That would stop any movement, and when you go back to frame 2, it might start again with no problem (depending on how you coded it)
gordeaoux is offline   Reply With Quote
Old 04-08-2009, 08:06 PM   #3
ImOnCloudNine69
Registered User
 
Join Date: Jan 2009
Posts: 5
Default

Quote:
Originally Posted by gordeaoux View Post
It sounds like you'll need to explicitly stop the movement of the ship/bullets/enemies in your actionscript. How are you moving the stuff around? Is it in an onEnterFrame handler? If so, you could try putting an empty onEnterFrame section on frame 3, as in:



That would stop any movement, and when you go back to frame 2, it might start again with no problem (depending on how you coded it)
yeah its all onEnterFrame. movements of _x and _y and hittests and stuff. but not only are they still moving they are showing through to the frame 3.

ALSO it duplicates my ship MC when i go back to my game frame. your code did stop the SHIP movement only however. the enemies still moved and what not. because they have their own onenterframe. i move the ship with mouse move. so im not actually sure why adding an onenterframe even worked.

i looked back on my code and i lied. i guess i do move the ship with onEnterFrame inside of a function i call from mousemove.
ImOnCloudNine69 is offline   Reply With Quote
Old 04-08-2009, 08:12 PM   #4
gordeaoux
Senior Member
 
Join Date: Sep 2007
Posts: 100
Default

You could add some code on frame 3 to drop the alpha of all the stuff you want hidden to 0 or you could attach a movie on top of everything that simply hides it all. So:

my_ship._alpha = 0;
my_bullets._alpha = 0;

or

attachMovie("pauseMenuMovieClip", "pauseMenu", this.getNextHighestDepth)

then when you go back to frame 2, add an unloadMovie("pauseMenu")
gordeaoux is offline   Reply With Quote
Old 04-08-2009, 08:19 PM   #5
ImOnCloudNine69
Registered User
 
Join Date: Jan 2009
Posts: 5
Default

Well that would hide them sure. no problem. but i have so many enemies and bullets hiding them all would be annoying loops. and besides all of that, it doesnt PAUSE the movement. which is the point of this. they need to stop moving so you can continue where you left off. also they need to pretty easily resume movement with their usual onEnterFrame.
ImOnCloudNine69 is offline   Reply With Quote
Old 04-08-2009, 08:32 PM   #6
gordeaoux
Senior Member
 
Join Date: Sep 2007
Posts: 100
Default

what happens when you go back to frame 2? it might be easier if you posted your fla so I can see what's going on.
gordeaoux is offline   Reply With Quote
Old 04-08-2009, 09:20 PM   #7
ImOnCloudNine69
Registered User
 
Join Date: Jan 2009
Posts: 5
Default

Hey. its really hard to explain. ill post a link to my.zip file. it contains my fla and some other stuff having to do with the game. some necessary some not.

http://rhsweb.org/kheath/Raiden%20HxC.zip
its my schools online website hosting.

ps, if you just run the fla, my ESCAPE key doesnt work. i had to run the EXE which is just the fla embedded into Visual Basic. (press ctrl-enter to run it, then close the fla, and open the exe, that will have updated it. not sure why, but i had it embeded because it gets the windows username. (school issue, my teacher wouldnt let me let the kids input names because they will use bad words. lol)

try playing around with it. you press space to make the enemies come, and you have to shoot at least once before you try pressing pause, otherwise it doesnt register or something, anywayssss. thankkks.
ImOnCloudNine69 is offline   Reply With Quote
Old 04-08-2009, 11:08 PM   #8
ImOnCloudNine69
Registered User
 
Join Date: Jan 2009
Posts: 5
Default

Im not sure why it duplicates my ship and does some weird **** where it uses both but goes back and forth between them. i understand that it might not stop but still need help with this, and also with them still being visible.

I know its possible because like every flash game ever created has a pause option. please help
ImOnCloudNine69 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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[AS2] Combobox problem: addItem only adds 1st item, but length returns as expected Continuity-B Components 2 01-05-2011 08:32 PM
gotoAndStop picture problem alexmel7 ActionScript 3.0 0 02-02-2009 05:08 PM
gotoAndStop variable problem ozren123 ActionScript 2.0 3 11-06-2006 06:02 AM
gotoAndStop problem moovida ActionScript 1.0 (and below) 6 01-13-2003 02:17 PM
gotoAndStop problem jrb ActionScript 1.0 (and below) 5 10-16-2001 09:17 PM


All times are GMT. The time now is 07:53 AM.

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