hi .
i am having a sound ,length of 1:30min. I embedded it into my swf and sync it with the frame. What i need is to pause and play this sound by my action script.
how to do this ? Any ideas?
hi .
i am having a sound ,length of 1:30min. I embedded it into my swf and sync it with the frame. What i need is to pause and play this sound by my action script.
how to do this ? Any ideas?
I just did a test to see it works.
Here's the basic code:
//playBtn and pauseBtn are two basic buttons
//sound is the movie clip that holds the synched sound in its timeline
playBtn.addEventListener(MouseEvent.CLICK, playSound);
pauseBtn.addEventListener(MouseEvent.CLICK, pauseSound);
function playSound(event:MouseEvent):void{
sound.play();
}
function pauseSound(event:MouseEvent):void{
sound.stop();
}
Hope it helps
If you want to control embedded sound globally, There is a class is AS3 called SoundMixer. You can control all sound globally as below code,
SoundMixer.soundTransform = new SoundTransform(0); //This will mute all sound from SWF. SoundMixer.soundTransform = new SoundTransform(1); //This will unmute all sound from SWF.
But if you want to control individual sounds embedded in MovieClips, above method wont work. In this case, Every Sprite and MovieClip class has a property called soundTransform. You can change soundTransform property of objects of MovieClip or Sprite and control them.
You can also give linkage to Sound in library and create sound dynamically. In this way though, syncing couldn't be accomplish.