PDA

View Full Version : as3 Watcher



mygrafik
December 21st, 2007, 10:31 AM
hi

as2 code


var Watcher:Function = function(prop, oldVal, newVal ):Number {
trace( newVal )
return newVal;
}
_root.watch("x_var", Watcher, 55);
x_var = 10


as3 code
?...

Felixz
December 21st, 2007, 01:08 PM
it was some days ago

private var _value:SomeType;
public function set value(val:SomeType):void {
doOtherThings();
_value=val;
}
public function get value():SomeType {
return _value;
}

mygrafik
December 21st, 2007, 04:08 PM
thanks much

mcarey
July 14th, 2008, 03:25 PM
(maybe much too late to pic up this thread, but I'll try...)

what if you're trying to 'watch()' a system level var/prop, such as loaderInfo.parameters for update ( see http://www.kirupa.com/forum/showthread.php?t=289313 , for context - communication with a c++ or vb wrapper )... in that case a custom 'set' accessor method won't work ( ie, set loaderInfo.parameters.myParam(val:*).... )

thoughts?

senocular
July 14th, 2008, 03:26 PM
SOL. You'll have to set up a poller or create your own get/set API if possible