MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 945

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

If your component extends UIComponent or UIObject, Flash automatically calls
createChildren()
shown here:
class MyComponent extends UIComponent{
...
// this is the constructor function
function MyComponent(){
}
}
All version 2 components should define an
has been called. You should place the initialization code in the component's
more information, see the next section.
If your component extends MovieClip, you may want to call an
createChildren()
function, as shown here:
class MyComponent extends MovieClip{
...
function MyComponent(){
init()
}
function init():Void{
init();
createChildren();
layout();
}
...
}
For more information about constructors, see "Constructor functions" in Using ActionScript in
Flash.
Defining the init() method
Flash calls the
init()
component is instantiated and never again.
You should use the
Call
super.init().
This is required.
Make the
boundingBox_mc
boundingBox_mc.width = 0;
boundingBox_mc.height = 0;
boundingBox_mc.visible = false;
Create instance member variables.
The
,
width
height
, and
methods and you can leave your constructor function empty, as
size()
method, and a method that lays out your component from the constructor
method when the class is created. This method is called once when a
method to do the following:
init()
invisible.
, and
parameters are properly set only after this method is called.
clip
function that is called after the constructor
init()
init()
Creating the ActionScript class file
,
init()
function. For
init()
method, a
945

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents