• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Customizing Objects > WATCHING PROPERTIES

WATCHING PROPERTIES

By now you know that you can give objects (including movie clips) properties (also known as variables). In a typical Flash application, the value of these properties can change at any time. And just as with real-world objects, a property change can have a couple of results: Not only is the object with the changed property affected, but a number of other objects can be affected as well, in a chain reaction of changes. For example, assume weather is an object and that the condition of the weather (a property of weather, as in weather.condition ) went from sunny to rainy (weather.condition = "rainy"; ). As a result, the sky gets dark, car lights come on, and windshield wipers start working. ActionScript employs the watch() method to watch various properties (variables, such as condition in our example) of objects, so that if a change occurs in the property value, a function can be called so that your project can react to the change. If you were to use this method, it would look something like this:

					nameOfObject.watch("propertyToWatch", nameOfFunction);
				


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint