Tutorials Home
What's New
Top Rated
Submit
myTutes
Random!
How to Use Flash MX Sound Objects
Author: Kenny Bellew
| Website: http://www.cowfly.com |
How to Use a Single Button both to Start and Stop a Sound Object |
|
I've been asked a few times how to use the same button to toggle the sound on and off. Here is the code for that:
on(release) {
if (_root.playing!=1) {
if (mySoundPosition==nul) {
mySoundPosition=0;
}
_root.mySound.start(mySoundPosition,0);
_root.playing=1;
} else {
if (_root.playing==1) {
mySoundPosition=_root.mySound.position/1000;
_root.mySound.stop();
_root.playing=0;
}}
}
// Be sure to change "mySound" to the name of your sound object. |
| » Level Intermediate |
|
|
Added: : 2004-10-12
Rating: 8.48 Votes: 31
Hits: 1290
|
| » Author |
|
Kenny Bellew is a technical writer and freelance flash programmer who specializes in Flash audio. He lives in Minneapolis, MN.
|
| » Download |
|
Download the files used in this tutorial.
|
|
Download (12927 kb)
|
|
Get conversion and unzipping tools
for PC and Mac here!
|
| » Forums |
|
More help? Search our boards for quick answers!
|
|
Please rate this tutorial, 10 is the top rating, you can also click the
comments link to read/write a review.
|
|
|