PDA

View Full Version : Setting a global variable from within a function?



Head In A Pan
July 24th, 2007, 12:15 AM
Hello!

I thought the following was how I set a global variable from within a function, but I'm not getting a trace on it...

So how do I set a global variable from within a function?! :)



_global.myVariable = this;

btn_first.onRelease = function(){
_global.myVariable.property="First";
trace(myVariable);
}

btn_second.onRelease = function(){
_global.myVariable.property="Second";
trace(myVariable);
}

Krilnon
July 24th, 2007, 01:31 AM
You aren't tracing _global.myVariable…?

Head In A Pan
July 24th, 2007, 01:35 AM
Even tracing _global.myVariable doesn't seem to work... I think I've declared the global variable somewhere else...