Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Creating Components > Creating the ActionScript class file > About core functions > Defining the init() method | |||
Flash calls the init() method when the class is created. This method is called only once when a component is instantiated.
You should use the init() method to do the following:
super.init(). This is required.
boundingBox_mc invisible.boundingBox_mc.width = 0; boundingBox_mc.height = 0; boundingBox_mc.visible = false;
The width, height, and clip parameters are properly set only after this method is called.
The init() method is called from UIObject's constructor, so the flow of control climbs up the chain of constructors until it reaches UIObject. UIObject's constructor calls the init() method that is defined on lowest subclass. Each implementation of init() should call super.init() so that its base class can finish initializing. If you implement an init() method and you don't call super.init(), the ()init method is not called on any of the base classes, so they might never be in a usable state.
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00002508.html