[問題] SoundChannel與SoundTransform

作者: heavenbetula (綠草)   2014-03-11 00:29:37
請問各位大大:
SoundChannel.soundTransform 與 SoundTransform的差異性在哪呢?
我簡單測試了一下:
var sound:Sound = new Sound();
sound.load(new URLRequest("music.mp3"));
var myChannel:SoundChannel = new SoundChannel();
var mytransform:SoundTransform = new SoundTransform();
stage.addEventListener(MouseEvent.CLICK,go)
myChannel = sound.play();
function go(event:MouseEvent){
var aa = myChannel.soundTransform;
aa.volume -=0.1;
myChannel.soundTransform = aa;
}

var sound:Sound = new Sound();
sound.load(new URLRequest("music.mp3"));
var myChannel:SoundChannel = new SoundChannel();
var mytransform:SoundTransform = new SoundTransform();
stage.addEventListener(MouseEvent.CLICK,go)
myChannel = sound.play();
function go(event:MouseEvent){
mytransform.volume-=0.1;
myChannel.soundTransform = mytransform ;
}
看起來 SoundChannel 裡的 soundTransform,與 SoundTransform 沒什麼差異...
但是實際上這兩個的關係真的沒差嗎...?
作者: KawasumiMai (さあ、死ぬがいい)   2014-03-11 13:08:00
沒差,因為物件是一樣的每個屬性有它自己的類型,如name是String,x是floatSoundChannel裡面的soundTransForm實際上就是個SoundTransform物件掛在他下面第一種你是拿一個新的SoundTransform抓進去取代第二種則是把他的SoundTransform抓出來修改後取代問題在new SoundTransform的時候他抓到什麼資訊
作者: heavenbetula (綠草)   2014-03-11 19:18:00
原來如此!感謝!

Links booklink

Contact Us: admin [ a t ] ucptt.com