Sound_step2 マウスのX座標でPAN
// forked from hacker_fuxxpyai's Sound_step1
package
{
import flash.display.Sprite;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.events.Event;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
public class Main extends Sprite
{
private var _channel:SoundChannel;
public function Main():void
{
var _snd:Sound = new Sound;
var _url:String = "http://www.muraken.biz/wonderfl/test.mp3";
var _req:URLRequest = new URLRequest(_url);
_snd.load(_req);
_channel = _snd.play(0,int.MAX_VALUE);
addEventListener(Event.ENTER_FRAME, _update);
}
private function _update(e:Event):void
{
var _sndTransform:SoundTransform = new SoundTransform;
_sndTransform.pan = (mouseX - stage.stageWidth / 2) / (stage.stageWidth / 2);
_channel.soundTransform = _sndTransform;
}
}
}