Hi!
I have trouble with applying Sound.setTransform to Movieclip which is loaded as the runtime library soundManager (path: MainEngine3_9_2_compact\module\sound).
It loads MP3 file, and I want to add setTransform to it (to control ONLY movieclip with MP3 in it)
but instead, after compiling, it applies setTransform to entire ROOT of swf (globally).
no matter what I've tried, which syntax I've used, it's either not working at all, or transforms the sound of entire document.
I'll upload the FLA with main document, and also there is FLA and AS of MP3-loading module.
The sound seems to be coming from _root, when modifying lr to 100 I can easily notice a change between both speakers:
PHP Code:
setTimeout(delay,1)//delay 1ms before applying setTransform.
function delay(){
var audio_sound:Sound = new Sound(_root);
audio_sound.setTransform({ll:100, rl:10, lr:100, rr:0});
}
stopAllAudio()//Loops through each sound in allSounds array and stops it.
Call this to stop all sounds & delete them from the array:
PHP Code:
deleteAllAudio()//Stops each sound & sets the array position back to 0 for allSounds.
If you are not keeping track of the last sound number you attached for allSounds you can call set transform for the latest attachment as so:
PHP Code:
createSound("digitall_amb_mono");//Create a new sound not keeping track of how many are currently being played.
_root.allSounds[_root.allSounds.length-1].setTransform({ll:0, rl:0, lr:0, rr:100});//Modify setTransform for the last sound created.
Inside of "Replic.fla"
PHP Code:
_root.module.replicManager.initReplic(function(){
trace("Реплики готовы");
_root.allSounds[0].stop()//Call this to stop the audio thats inside of main.fla
});
Inside of the first keyframe for "Main.fla" you left audio you should set the audio for SOUND TEST keyframe to none.
If you have multiple sounds playing at once you can even transform them all in one call by adding this script to "main.fla" along with the script from post #5
PHP Code:
function transformAllAudio(a,b,c,d){
for(var i=0;i<allSounds.length;i++){
allSounds[i].setTransform({ll:a, rl:b, lr:c, rr:d});
}
}
If you just want to transform the latest sound you attached with createSound("linkage")
PHP Code:
_root.allSounds[_root.allSounds.length-1].setTransform({ll:0, rl:0, lr:0, rr:100});//Modify setTransform for the last sound created.
To set transform for a specific sound you have playing you can select it by array position:
PHP Code:
_root.allSounds[0].setTransform({ll:0, rl:0, lr:0, rr:100});//Modify setTransform for the sound in array position 0.
Here is the full audio source for "main.fla":
PHP Code:
var allSounds:Array=new Array();
function createSound(a){
var my_sound:Sound = new Sound();
my_sound.attachSound(a);
my_sound.start(0,999);
allSounds.push(my_sound)
my_sound.setTransform({ll:0, rl:0, lr:100, rr:0});
}
function stopAllAudio(){
for(var i=0;i<allSounds.length;i++){
allSounds[i].stop();
}
}
function deleteAllAudio(){
for(var i=0;i<allSounds.length;i++){
allSounds[i].stop();
}
allSounds=new Array();
}
function transformAllAudio(a,b,c,d){
for(var i=0;i<allSounds.length;i++){
allSounds[i].setTransform({ll:a, rl:b, lr:c, rr:d});
}
}
createSound("digitall_amb_mono")//Create a sound.
//allSounds[0].setTransform({ll:0, rl:0, lr:0, rr:100}); //Transform just for audio at position 0
//stopAllAudio()//Stop all audio.
//deleteAllAudio()//Delete all audio and stop it.
//transformAllAudio(100,10,100,0);//ll:100, rl:10, lr:100, rr:0 //Transform all audio that is currently playing.
//_root.allSounds[_root.allSounds.length-1].setTransform({ll:0, rl:0, lr:0, rr:100});//Modify setTransform for the last sound created without keeping track of the sound number.
Ok yeah, I see your main problem, some of the script is still useable though, So I noticed even when loading 2 swf's it will share the audio transform, so I had to produce the sounds manually for each pitch which actually isn't so bad, only the size I have to work on.
This work around might be good, this is just a small demo, let me know.
Each green mc has a sound object script, & you can adjust the setTransform for them individually by modifying the text field:
PHP Code:
onClipEvent(load){
var snd:Sound = new Sound(this);//Use 'this' as the accessor for sound inside of a movieclip.
snd.attachSound("sound1.wav");
snd.start(0,999);