Copy link to clipboard
Copied
how are you guys
here
i did this
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
public class admin1 extends MovieClip
{
var WIND:wind; // the sound file name
var SOUNDCHANNEL:SoundChannel
public function admin1(){
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage)
}
public function onAddedToStage(event:Event):void
{
WIND = new wind;
SOUNDCHANNEL = WIND.play()
}
}
}
it works but only one time i wanna the sound keep working after finished
thank you
use:
...
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
public class admin1 extends MovieClip
{
var WIND:wind; // the sound file name
var SOUNDCHANNEL:SoundChannel
public function admin1(){
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage)
}
public function onAddedToStage(event:Event):void
{
WIND = new wind;
SOUNDCHANNEL = WIND.play(0,1000); loops
Copy link to clipboard
Copied
use:
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
public class admin1 extends MovieClip
{
var WIND:wind; // the sound file name
var SOUNDCHANNEL:SoundChannel
public function admin1(){
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage)
}
public function onAddedToStage(event:Event):void
{
WIND = new wind;
SOUNDCHANNEL = WIND.play(0,1000); loops 1000 times
}
}
}
Copy link to clipboard
Copied
ohh thank you alot brother
only 1 last please
how can i change the sound if this sound finish to another sound
like wind then rain sound
and thank you again brother thats realy help me alot
Copy link to clipboard
Copied
the soundchannel class has a soundcomplete event you can use after you remove that loop parameter from the play() method:
package{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
public class admin1 extends MovieClip
{
var WIND:wind; // the sound file name
var SOUNDCHANNEL:SoundChannel
public function admin1(){
addEventListener(Event.ADDED_TO_STAGE,onAddedToStage)
}
public function onAddedToStage(event:Event):void
{
WIND = new wind();
SOUNDCHANNEL = WIND.play();
SOUNDCHANNEL.addEventListener(Event.SOUND_COMPLETE,soundcompleteF);
}
private function soundcompleteF(e:Event):void{
var rain:Rain=new Rain();
SOUNDCHANNEL.removeEventListener(Event.SOUND_COMPLETE,soundcompleteF);
SOUNDCHANNEL=rain.play();
}
}
}
Copy link to clipboard
Copied
thank you alot brother
Copy link to clipboard
Copied
you're welcome.