I'm after music playing on frame 4, but if at any time a key is pressed (say 'M' the music will stop (and restart if pressed again) and then whatever state it's in it should stop on the last frame (I'm guessing StopallSounds will do that).
So all I need is a code that starts and stops the music. Can anyone help?
I don't exactly understand what you're looking for. Do you want toggle music (on/off) when you press the M key? And what do you mean by 'I'm after music playing on frame 4'?
I'm assuming your playing the music within a keyframe, if so you may want to try pulling the sound file in from the library with actionscript Sound class.
Ok well another way to call a sound file (which would work better if you're using a key press) is to:
1st: Right click the sound file, click on 'Linkage' and then click the 'export for Actionscript' button and name it whatever you want ('mySound' for example).
Then you can now make an instance of it in your actionscript by putting code like this on the main timeline:
<i>var soundname:Sound = new Sound(); soundname.attachSound("mySound"</i>
Then you can call the following functions to call that sound to start or stop: <i> soundname.start(0, 0); soundname.stop(); </i>
Hope it helps, let me know if you don't understand how to use this, and please be specific
Good point, if you are using loopable music you should use a high number for the first parameter (such as 99999), otherwise if you want the sound to happen only once use 0.