TheMonkxx
03-03-2006, 11:59 PM
Hello,
I have a movie that is creating a sound object and loading the sound into it. Now a script on in a sepetate MC calls the function and passes it parameters that it needs to call the sound in question. Trouble is when the function gets the parameters it won't play the sound. But if I hand code the same parameters into the function the sound plays fine. Have a looK:
------------------------------------------------
trexstep=new Sound();
trexstep.attachSound("sound_trexstep");
function playsounds(soundname,looped) {
_root.soundname.start(0,looped);
//_root.trexstep.start(0,1)
}
-----------------------------------------------
And here is the code that appears which calls the function:
-----------------------------------------------
_root.playsounds("trexstep",1);
-----------------------------------------------
The function call works correctly because if I uncomment the code on the second line of my function I hear the sound. For some reason I can't play the sound when I pass the values to the function. Any ideas? (I did a trace on the function and it's receiving the values the function call is giving it)
Thanks!
Monk
Note: I realise I could save myself the trouble and just add "_root.trexstep.start(0,1)" to the frame but when I noticed this wasn't working I became obsessed on figuring out why. heh. You can't learn if you never take the time to figure out "why?" ;)
I have a movie that is creating a sound object and loading the sound into it. Now a script on in a sepetate MC calls the function and passes it parameters that it needs to call the sound in question. Trouble is when the function gets the parameters it won't play the sound. But if I hand code the same parameters into the function the sound plays fine. Have a looK:
------------------------------------------------
trexstep=new Sound();
trexstep.attachSound("sound_trexstep");
function playsounds(soundname,looped) {
_root.soundname.start(0,looped);
//_root.trexstep.start(0,1)
}
-----------------------------------------------
And here is the code that appears which calls the function:
-----------------------------------------------
_root.playsounds("trexstep",1);
-----------------------------------------------
The function call works correctly because if I uncomment the code on the second line of my function I hear the sound. For some reason I can't play the sound when I pass the values to the function. Any ideas? (I did a trace on the function and it's receiving the values the function call is giving it)
Thanks!
Monk
Note: I realise I could save myself the trouble and just add "_root.trexstep.start(0,1)" to the frame but when I noticed this wasn't working I became obsessed on figuring out why. heh. You can't learn if you never take the time to figure out "why?" ;)