What version of Flash are you using? What's the bitrate of the sound?
I assume it is in the library and you are doing the following: Right Click -> Properties -> ActionScript -> Trying to check the "Export for ActionScript" checkbox and it is grayed out?
What you are doing should definitely work as far as I know because I am pretty sure the sound doesn't even import into Flash if the bitrate is too high but still something to check.
i'm not sure where you see Sound Properties but you should be right clicking your sound in the library panel>click properties>tick export for actionscript and the class and base class fields should be filed in and editable.
I just found out that the reason the reason why it was not editable is because the document has been set up for Actionscript 1.0 and 2.0, not 3.0. I tried to follow this video: http://www.youtube.com/watch?v=r5Ai4-j0bUc on how to export sound to actionscript.
I've been trying to find the Actionscript 1.0/2.0 version of that workflow to set up a sound, volume, play, frame range, play increment, etc. Is it essentially the same coding?
// The section below imports the sound you just "Exported for Actionscript"
// Replace "sound" with the "Class" name you put in the ActionScript tab for the audio clip
// ** If there is more than one sound, then copy & paste the line below and rename the "sound1" and "sound" to each new audio.
// ** Do the same process with the ".play" line at the bottom of the program
var sound1 = new sound();
// Section below controls the audio volume. Range is between 0-1.
// Example: .5 >>>> 50% volume
var myvolume:SoundTransform = new SoundTransform(.5);
// Below controls the
// (<starting frame within audio track>, <frame increment or how fast the track plays>,<Connects to Volume - ignore it>)
sound1.play(0, 1, myvolume);
no. the coding will be substantially different for as2.
to start, you'll need to use a linkage id (eg, soundID) for your sound, not a class name.
then you'll need to apply attachSound to a sound instance.
var s:Sound=new Sound();
and then the differences continue:
Thanks for the reply! I am wondering if it is possible to use actionscript to properly stop ALL the sound in a scene when a button is pressed. Both a "forward" and "back" buttons are set up and are each in their own respective layers. There are also images that have been set up as buttons that produce a sound when pressed. However, even when I put the code below in the forward/back buttons, the scene audio from those image buttons continues until finished. Note that the sound files are on the timeline on their own layers within the symbols.
Are only the sounds that are imported/linked into ActionScript able to be stopped by the "stop" functions?
1 person found this helpful
stopAllSounds() will stop all sounds, no matter how they started, that are playing at the time it executes. however, it does not stop a sound from starting and continuing to play after it executes.