ActionScript 3 AS3声音听众

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3声音听众相关的知识,希望对你有一定的参考价值。

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;
 }




}

以上是关于ActionScript 3 AS3声音听众的主要内容,如果未能解决你的问题,请参考以下文章