Search Tutorials
Actionscript Primer Objects in Flash 5 Flash 5 actionscript follows the same coding standard as Javascript, so you can take advantage of the same standard way of addressing objects as you would in Javascript or any other object-oriented language. In addition to standard objects like Date, Array, Math, and String, Flash 5 also treats Movieclips as objects, and has introduced a Color object, which allows the color of a movieclip to be changed dynamically. Both of these objects will be used in this tutorial. Other objects specific to Flash 5 which are documented in the ActionScript Dictionary include Key (for responding to particular keyboard entries), Mouse (to hide the cursor and show a custom one), Sound, and XML. Methods and properties of objects Each of the predefined objects has predefined properties (as movieclips did in Flash 4 -- eg, x position, alpha, rotation), and predefined methods. Methods are actions that can be carried out on the object in a defined way, often with specified arguments. DuplicateMovieClip, for example, does what its name implies and takes two arguments: the instance name of the duplicated clip and the depth of the new clip. mcBase.duplicateMovieClip("mcBase3", 44) creates a movieclip named mcBase3 at a depth of 44 which is an exact duplicate of mcBase. Examples of applying the methods and setting the properties of movieclips in Flash 5 are given in the table below. Dot syntax As in Flash 4, objects in Flash 5 must be addressed by their complete paths, relative to the command being given. But instead of using "/" to refer to the main timeline and ":" to refer to a variable, a new object syntax is used, known as "dot syntax". In dot syntax, nested objects are separated by dots which define the object's "path" (much like slashes did in Flash 4). In addition, the object's methods and properties are also accessed with dot syntax, by appending the property or method to the end of the object path, after its own dot.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|