Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Audio

Categories How to Use Flash MX Sound Objects
Author: Kenny Bellew | Website: http://www.cowfly.com |

 
Page 6
«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... next»

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.

«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... next»

» 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.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers