PDA

View Full Version : Listening a variable


xxlm
06-27-2005, 04:31 AM
Hi mates...

Ok this is what I want to achieve.
I would like to be able to know when a var is changed in my swf

So I thought about listener but seems that I'm not able to use it for this (or I uising it the wrong way).

COuld anyone show me the way pls...

Thx

Laguana
06-27-2005, 06:31 AM
Well, one way would be to set up an interval or onEnterFrame which checks the current state of the variable against hte previous one, then sets the previous to the current and tells you if it's different. Other than that, i don't really know.

xxlm
06-27-2005, 07:02 AM
yeah it was one of the idea I got, but I was thinking of a real listener which is calling a function when the value change.

Thx anyway ;)

Xeef
06-27-2005, 07:18 AM
F = function (prop, oldVal, newVal) {
trace(prop+" hase changed from "+oldVal+" to "+newVal);
return newVal;
};
_root.watch("a", F);
a = 10;

xxlm
06-27-2005, 08:05 AM
watch....
raaaahhhhhhhhhhh It falls in the abyss of my mind...

Thx a lot !!!