How to change the volume of a Sound using keyboard input?
问题 How can I increase/decrease the volume of a Sound on key-press in ActionScript 3.0 回答1: private var sound:Sound; private var channel:SoundChannel; private const INCREMENT:Number = 0.2;//change it as you like sound = new Sound(); sound.addEventListener(Event.COMPLETE, onLoad); sound.load(new URLRequest("song.mp3")); function onLoad(e:Event):void { channel = sound.play(); if(stage) { stage.addEventListener(KeyboardEvent.KEY_UP, onKey); } else trace("call this from a display object on stage"); }