Welcome to our blog! Here you can find stuff about web development, software engineering, WordPress & about our projects and interests.
Page of the event – https://www.facebook.com/events/684600421568701/
I use flash to achieve this. Create a new flash file with AS3. Create two buttons which will be placed one above the other. The stop button instance is called xstop and the play button instance is called xplay.
And this is the code:
//think of the soundchannel as a speaker system and the sound as an mp3 player var soundChannel:SoundChannel = new SoundChannel(); var sound:Sound = new Sound(new URLRequest("http://www.kavdesign.net/sites/stgeorge/birds1.mp3")); xstop.addEventListener(MouseEvent.CLICK, clickStop); xplay.addEventListener(MouseEvent.CLICK, clickPlay); playMusic(); function clickPlay(evt:MouseEvent) { playMusic(); } function clickStop(evt:MouseEvent) { soundChannel.stop(); soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic); xstop.visible = false; xplay.visible = true; } function playMusic():void { soundChannel = sound.play(); soundChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic); xstop.visible = true; xplay.visible = false; } function loopMusic(e:Event):void { if (soundChannel != null) { soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic); playMusic(); } }