/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var soundPlaying:Boolean = false; var _playPosition:int; //This is your code here hannah var snd:Sound = new Sound(); snd.load(new URLRequest("http://www.lazytoolbox.co.uk/05BLACKLOCUST.mp3")); var channel:SoundChannel = new SoundChannel(); channel = snd.play(0, int.MAX_VALUE); soundPlaying = true; //////////////////////// ////////////////////////// // Stuff I Added in // ////////////////////////// pausebuttonname.addEventListener(MouseEvent.CLICK, onPause); //Code for Pause public function onPause(Event:MouseEvent):void { if(soundPlaying == true) { _playPosition = channel.position channel.stop(); soundPlaying = false; } else { channel = sound.play(_playPosition); soundPlaying = true; } }