我正在 as3 中构建音频定序器。我有一个 Track 类,其中包含一个播放按钮来播放一次声音、一个音量滑块和 16 个复选框来打开/关闭 16 个步骤中的每一个。舞台上有 8 个 Track 实例。我想知道的是如何唯一识别正在单击的按钮/滑块/复选框?我在哪里加载每个声音?boleow 是我的 Track 课程
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
public class Track extends MovieClip
{
private var soundName:Sound;
private var theChannel:SoundChannel;
private var songName:String;
public function Track()
{
// constructor code
trace("track created");
singlePlay.addEventListener(flash.events.MouseEvent.CLICK, handlePlayClick);
}
private function handlePlayClick(e:Event):void
{
trace("Play clicked");
this.play();
}
public function setSoundName(theName:String):void
{
this.songName = theName;
soundName = new Sound();
var req:URLRequest = new URLRequest(this.songName);
soundName.addEventListener(Event.COMPLETE, playSound);
soundName.load(req);
}
public function playSound()
{
theChannel = soundName.play();
}
public function stopSound():void
{
theChannel.stop();
}
}
}