Object.watch() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

Object.watch()

Availability
Flash Player 6.
Usage
myObject.watch( prop:String, callback:Function [, userData:Object] ) : Boolean
Parameters
A string; the name of the object property to watch.
prop
The function to invoke when the watched property changes. This parameter is a
callback
function object, not a function name as a string. The form of
oldVal, newVal, userData)
An arbitrary piece of ActionScript data that is passed to the
userData
the
parameter is omitted,
userData
is optional.
Returns
A Boolean value:
Description
Method; registers an event handler to be invoked when a specified property of an ActionScript
object changes. When the property changes, the event handler is invoked with
containing object.
Your can use the
property you are watching. The value returned by your
watched object property. The value you choose to return depends on whether you wish to
monitor, modify or prevent changes to the property:
If you are merely monitoring the property, return the
If you are modifying the value of the property, return your own value.
If you want to prevent changes to the property, return the
If the
callback
property is assigned a value of
A watchpoint can filter (or nullify) the value assignment, by returning a modified
). If you delete a property for which a watchpoint has been set, that watchpoint does not
oldval
disappear. If you later recreate the property, the watchpoint is still in effect. To remove a
watchpoint, use the
Only a single watchpoint can be registered on a property. Subsequent calls to
on the same property replace the original watchpoint.
676
Chapter 2: ActionScript Language Reference
.
undefined
if the watchpoint is created successfully,
true
statement in your
return
method you define does not have a
undefined.
method.
Object.unwatch
callback
is passed to the callback method. This parameter
false
method definition to affect the value of the
callback
callback
parameter.
newVal
oldVal
statement, then the watched object
return
is
callback(prop,
method. If
callback
otherwise.
myObject
method is assigned to the
parameter.
newval
Object.watch()
as the
(or

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash mx

Table of Contents