|
|
||||||||||
| Ultrashock Tutorials > Flash MX 2004 > Introduction to the v2 component architecture | ||||||||||
|
||||||||||
|
|
Introduction to the v2 component architecture |
|
||||||||
II. Public APIOne of the benefits of using component architecture, as was mentioned at the beginning of the tutorial, is for us to do less work. So far, that might not seem like the case. So we’ll take a bit of time to check out some of the things that component architecture does do for us. a. Methodsmove(x,y) The move() Method receives two parameters x and y and will itself move the component to the new location. This is a correct technique for moving components in Flash MX 2004 as users should not manipulate the _x or _y values directly. setSize(width,height) You might recall the size() method from earlier discussion. The setSize() method actually implicitly calls the size() method and handles some other required things by the component architecture. It is responsible for preparing the __width, __height, oldWidth, and oldHeight properties before calling the size() method. The important thing to keep in mind is that your size() method implementation should correctly resize things at runtime or else the setSize() method may not work properly and you do not usually override the setSize() method. b. Read-only PropertiesThere are many read-only properties that are implemented in UIObject for us. These read only properties are helpful for your users and are also used by some container classes in the version 2 component architecture. It is good to know about these properties, as in many cases you may not realize what was already implemented for you. Properties
c. Properties visibleThe visible property allows a user to hide/show the component. Not much required of us here but good to note that this implicitly sets the _visible property and will dispatch the appropriate event, either “reveal” or “hide”. If you want to implement your own handling of the visible property, you can override the setVisible() method. scaleX/scaleY These are equivalent to the _xscale/_yscale MovieClip properties.
|
||||||||||
©2004 Ultrashock.com - All rights reserved |