Music programming

Started by: bl3u | Replies: 2 | Views: 416

bl3u

Posts: 1,434
Joined: Feb 2012
Rep: 10

View Profile
Feb 10, 2013 1:50 AM #878793
Basically, how can I make a song play in a menu screen (3 screens included in the menu) and nowhere else?
Xero
2

Posts: 7,563
Joined: Feb 2012
Rep: 10

View Profile
Feb 10, 2013 2:02 AM #878807
For flash, correct?

You mean carry out the music on a menu and have it not restart?
[spoiler=]

A way I'd do it (might not be the easiest, but this is how I do it) is to have the 3 menu screens on 1 scene, and every button transitions to a different part of the scene taking you to the menu.
eg.
frame 1-25 is menu 1
frame 26-50 is menu 2
frame 51-75 is menu 3

and so on.
You need to have music set on event and loop (or put the music in a movie clip and have it in a frame throughout the scene.)

You'll also need a stop code at the end frame of each menu
stop();


to transition (incase you forgot) click on the button symbol and type
on release{
gotoAndPlay(enter frame number here);
}

I think it was.

When you switch to another scene, input the stopallsounds; script[/spoiler]
Ashish9
2

Posts: 319
Joined: Nov 2012
Rep: 10

View Profile
Feb 10, 2013 2:50 AM #878853
-Select the frame where you want to start the music to play.
-Drag the song from library to stage.
-On the property inspector at the bottom, select the sound type to 'event' if it is set to 'stream' and select 'loop' instead of 'repeat'.
-Now go to frame and select it where you don't want the music to play and press F9 to bring out the action panel and type in:
stopAllSounds();

I think this should resolve the matter.