I am working in air application , i need to know how to add event listener when any object is updated, how can i implement this.
Example: i have Class name Vehicle, and child class are Car,Bus,Bikes,Scooter,..etc, child class also have many properties like color,model no,….etc
I have array collection and AddChild() method in Vehicle class by this, i will add, child class to the vehicle class.
I need a event listener which can trigger if any of the property is updated or changed in any of the child class property, how can i implements this in Flex3.
I need this for knowing, is there any update happen in the Object.
Thanks In Advance
Best Answer
One thing you can do is to make getters and setters for the properties instead of public vars and have your class extend EventDispatcher, if it does not already do so because it is extended from a MovieClip, like:
(VehicleEvent being an extended class of Event with an extra string to signify which property changed)
Then you can add an eventlistener to the vehicles and they will dispatch events when the properties defined in this way change.