_global.myVar = "";
varSound = new Sound();
varSound.attachSound(_global.myVar);
function playSound(arg){
arg.start(0,1);
}
sound_btn.onRelease = function(){
playSound(varSound);
//myVar traces out as sfx2 after clicking button in code below so i don't get why it wont play
trace(_global.myVar);
}
I have the global myVar set as nothing to start. Within my movie a level deeper on click of a button i’m trying to set the global with this
preview_btn.onRelease = function(){
//trying to set variable here, it traces out as sfx2
_global.myVar = "sfx2";
trace("i just updated the root var myVar to "+ _global.myVar);
}
But the sound doesn’t play when clicking sound_btn. So i don’t know if it has something to do with trying to pass a variable into the declaration of the sound object or what. Can someone help?