00:00
00:00
Newgrounds Background Image Theme

KiichigoInu just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

I need AS2 menu help

763 Views | 7 Replies
New Topic Respond to this Topic

I need AS2 menu help 2013-04-08 21:40:24


Ok so I'm making a menu screen just like the example below but I dont know how to do this at ALL... and I'm hoping someone can understand what Im trying to say and give me extensive help on this... Not just the AS codes, but also how it should be placed in the timeline...
Basically I want each button to have its own movie clip and all come back to this menu but I also want a "play all" button for each row.
But Im not sure which codes for anything of it. And the play all part I just cant wrap my head around...
Anybody know where I'm getting at here? lol

I need AS2 menu help


BBS Signature

Response to I need AS2 menu help 2013-04-12 16:34:26


If the scenes are in separate MCs, then I would know how to do it.
Even if not, I should know.

But you have to trust me and send the FLA to me.


BBS Signature

Response to I need AS2 menu help 2013-04-12 16:36:29


I'll obviously explain it to you afterwards, but it's easier to show it that way.


BBS Signature

Response to I need AS2 menu help 2013-04-12 16:48:26


At 4/12/13 04:36 PM, Pkmn2 wrote: I'll obviously explain it to you afterwards, but it's easier to show it that way.

I haven't even built the file yet.. since this is a separate project I'm doing. when i get to it, ill send you the FLA


BBS Signature

Response to I need AS2 menu help 2013-04-18 11:56:55


Hello. Let's assume you have made an animation in Flash 8.
So it's like separated into Scenes. To edit the list of scenes, press Shift+F2. Or you can go to Insert->Scene.
Break down your long animation into scenes and write down all names of scenes in their order.
What you would like to do now is a menu which allows to:
1) start playing from a particular scene to the end of that scene;
2) start playing from the start of the movie to the end of the movie;

Now how to accomplish this.
1) Draw your menu. Make 1 button for each scene and 1 button for "Play all". Make your buttons Buttons, not MovieClips.
2) For each button, click it, go to Properties Inspector (Ctrl+F3) and type "Scene1", "Scene2", etc. Remember all their names.
3) Make a new scene and drag it to make it the first one. It does not matter how you name it.
4) Put all your buttons and menu picture into the first frame of the first scene.
5) While still being on first frame of first scene, click nowhere (deselect everything).
6) Open Actions or press F9 or go to Windows->Actions.
7) In the big text window type code:

if(Scenes==undefined){
Scenes=["Scene 1","Scene 2","Rob Pardo Kills Warcraft","Newgrounds Rules"];
Buttons=["scene1","scene2","rob","newgrounds"];//do not include PlayAll in this list
PlayAll=playall;
//Scenes is a list of your scene names
//Buttons is a list of button names in menu
//Elements of Scenes and Buttons are, well, related, and are in same order
//PlayAll= name of your Play All button, because it is special
Frames=[];
snd=new Sound();
snd.setVolume(0);
for(i=0;i<Scenes.length;i++){
gotoAndStop(Scenes[i],1);
Frames[i]=_currentframe;
}
gotoAndStop(1);
stopAllSounds();
snd.setVolume(100);
Mode=null;
onMouseDown=function(){
if(PlayAll.hitTest(_xmouse,_ymouse,true)){
Mode="all";
gotoAndPlay(Frames[0]);
stopAllSounds();
}
for(i=0;i<Buttons.length;i++)if(Buttons[i].hitTest(_xmouse,_
ymouse,true)){
Mode=i;
gotoAndPlay(Frames[i]);
stopAllSounds();
}
}
onEnterFrame=function(){
if(Mode==null)return;
for(i=0;i<Frames.length;i++)if(_currentframe==Frames[i])stop AllSounds();
if(Mode=="all" && _currentframe==1 || !isNaN(Mode) && _currentframe==Frames[Mode+1]){
Mode=null;
gotoAndStop(1);
stopAllSounds();
}
}
}

What will this code do? When you press a button, the code will play movie from the selected scene to the end of that scene. If you press PlayAll button, entire movie will be played. After playing is finished, you return to the menu.
When a scene finishes, all sounds and music are interrupted/stopped, even if it's currently playing all the scenes. So each scene starts in absolute silence.

What do you think about this?

Response to I need AS2 menu help 2013-04-18 12:14:35


Uhm, I'm sorry, Newgrounds broke my code up there. It won't work like this.
After you copy paste the code into Actions:
1) Go to line 13 and change it to 'gotoAndStop(Scenes[i])'
2) Merge line 26 with line 27.
3) On line 34 type 'stopAllSounds' instead of 'stop allSounds'
4) Close Actions and now go to every scene, click the first frame (if there are multiple first frames, click on any one) (frames can be clicked on in the Timeline), and then type the exact name of the scene into the Frame Label (in Properties Inspector). Repeat for all scenes.

And now it should work... [[code]]Also there is a code tag.[[/code]

Response to I need AS2 menu help 2013-04-18 14:06:41


wow, you really know how to code. I'm going to give it a try n a bit. ill reply if it works. thanks alot!


BBS Signature

Response to I need AS2 menu help 2013-04-20 17:16:36


So how's it going, TechLess? You did try it already, didn't you?
I came up with a bit less heavy method.

You stop playing the movie on first frame, and put your menu buttons into first frame.
You can click (once) on a button and type code (Actions) into it like this:
on(release){
//your code
}
So here we go, for button which takes you to scene 1, type code:
on(release){
_root.gotoAndPlay("My Scene Name", Frame_Number);
}
Or you can just specify a frame:
_root.gotoAndPlay( Frame_Number );

For "Play All" Button you type:
_root.play();

You cannot determine when a particular scene finishes playing, though.
I am absolutely positively SURE, that you do not care.
You just want to start playing your movie from a place other than start. So it should work.