PDA

View Full Version : vars from function


elfis
11-09-2003, 10:38 AM
Hi !! I am kinda confused about this - cant exchange the var in function and back .. var someVar:Number = 1
this.onEnterFrame = function() {
someVar = 3
};
trace(someVar);//traces "1" ..

so .. how to get "3" to be traced ??!?
tnx !!

senocular
11-09-2003, 11:28 AM
the onEnterFrame would have to be run first.

var someVar:Number = 1
this.onEnterFrame = function() {
someVar = 3
};
this.onEnterFrame();
trace(someVar);//traces "3"

either that or wait a frame (where its called automaically) THEN check someVar's value.

elfis
11-09-2003, 11:38 AM
hey thanks a lot !!! :) you saved a lot of headaches to me .. :D
cheers