var drum:DrumSound = new DrumSound();var channel:SoundChannel = drum.play();
SoundUtil.getInstance().playMusic("musicName", 2); // 2 would do a 2 sec. fade in
public function add (strSound:String, bIsMusic:Boolean):void { var refClass:Class = getDefinitionByName(strSound) as Class; var sndTmp:Sound = new refClass(); var iTmp:int = this._aSound.length; this._aSound.push(sndTmp); this._objSound[strSound] = { id:iTmp, bIsMusic: bIsMusic }; if (bIsMusic) { this._objSound[strSound].spDummy = new Sprite(); } }
private function onSoundComplete (e:Event):void { var strKey:String; for (strKey in this._objSound) { if (this._objSound[strKey].bIsMusic) { if (this._objSound[strKey].chChannel == e.target) { this._objSound[strKey].chChannel.removeEventListener(Event.SOUND_COMPLETE, this.onSoundComplete); this._objSound[strKey].bIsPlaying = false; // do some cleanup } } } }
Powered by: newtelligence dasBlog 1.9.6264.0
Disclaimer The opinions expressed herein are our personal opinions and do not represent our customer's view in anyway.
© Copyright 2009, gaming your way
E-mail