|
-
Stopping an MP3
Hi so iv created 2 scenes which are connected by a button which iv managed to code ok but now my problem is when I use the button the next scene appears but the mp3 from the previous scene keeps playing. Is there a code I can put into the actions of the button to stop the mp3?
Im a beginner, a basic, and a dope. Please Help!!! 
-
stopAllSounds();
If you put stopAllSounds(); on you button, I believe that will solve your problem.
BTW Why use scenes? Scenes are a poor strategy left over from the days of large CD files. It is my understanding that scenes are depricated in Flash, and that suggests that at some future time, a player will not support scenes. A far better strategy is to put your scenes in MCs (my opinion). You can place an MC on frame one and another on frame 2 (or you can put both on frame one and use _visibility). Each MC has its own timeline, just as a scene does.
When we first created Flash files, we put them on CDs. It didn't matter how large the file was, everything was on the CD. For that reason, we gladly used scenes as a way to organize our content. Now all of out content is accessed through the web. With the new goal of rapid download, scenes make much less sense. I suspect they are also inconsistent with object oriented programming (OOP) which should be the model all Flashers move toward.
To support rapid download, I use multiple swfs. I create these just like I create MCs and load them one on top of another in levels, just as you use layers on your timeline. I can unload them as I please and write code so that they communicate, just as your scenes communicate with each other.
Last edited by Thomas D.Garrod; 03-21-2007 at 12:44 PM.
Reason: typos
Tomas
-
sorry what i ment was mcs, thanks for the help, just placed the code in the actions section of the button and i get the following error message when i run the clip
**Error** Symbol=Quote, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
stopAllSounds();
Total ActionScript Errors: 1 Reported Errors: 1
Please Advise
Last edited by kyllle; 03-21-2007 at 12:43 PM.
Im a beginner, a basic, and a dope. Please Help!!! 
-
You need a handler
You have a button that tells the playhead to move to the next frame (or in your case, to the next scene).
Code:
on (release){
stopAllSounds();
nextScene();
}
Note that stopAllSounds(); is before nextScene(); otherwise, you will be directing your message to the wrong scene.
You might find this easier if you purchased a book. You can get all the information you need on the net, but it comes in thimble-fuls. Beginners like me need the small pieces and the big picture too. A good book can do that in a way that is difficult for the web. For every ten books on Flash, 9.5 are garbage. So, you might ask around before you buy.
Suggestions:
ActionScript for Flash MX: the difinitive guide, Colin Moock, O'Reilly
This book provides very basic information about event handlers, functions, operators, datatypes, and all of those scary subjects. The first chapter is titled: "A gentle introduction for nonprogrammers"
Another good book is Understanding Macromedia Flash 8: ActionScript 2. The "Bible" series is also widely regarded (although untested by me).
-
If no scenes...
nextFrame();
play();
gotoAndPlay(frame number or "name");//use when you want to navigate out of sequence.
(But you already know this.)
-
I think that's the book I pinch from my tutor at college most days. I highly recomend it. It's well written if not a little daunting at first. Excellent thing to have around even if you already know the answer and just need your mind jogged a little to get to it
-
thanks alot for the advise and the recommendations
Kyle
Im a beginner, a basic, and a dope. Please Help!!! 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|