Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > UIObject class > UIObject.createClassObject() | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
componentInstance.createClassObject(className,instanceName,depth,initObject)
className An object indicating the class of the new instance.
instanceName A string indicating the instance name of the new instance.
depth A number indicating the depth of the new instance.
initObject An object containing initialization properties for the new instance.
A UIObject object that is an instance of the specified class.
Method; creates an instance of a component at runtime. Use the import statement and specify the class package name before you call this method. In addition, the component must be in the FLA file's library.
The following code imports the assets of the Button component and then makes a subobject of the Button component:
import mx.controls.Button;
createClassObject(Button,"button2",5,{label:"Test Button"});
The following example creates a CheckBox object:
import mx.controls.CheckBox;
form.createClassObject(CheckBox, "cb", 0, {label:"Check this"});
You can also use the following syntax to specify the class package name:
createClassObject(mx.controls.Button, "button2", 5, {label:"Test Button"});
Flash CS3
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00003653.html
Comments
Dennis O'Brien said on Feb 25, 2009 at 7:42 PM :