Macromedia Flash8 Bible
You can add a component to your Stage in the following ways:
-
Open the Components panel by going to Window ð Components or by pressing Ctrl+F7 or z+F7.
-
Add a component to the Stage by:
-
Double-clicking: You can double-click a component and it will be added to the center of your Document window's workspace.
-
Dragging: You can add an instance by clicking the component icon and dragging it onto the Stage.
-
After your component is on the Stage, you can modify its parameters and properties manually in various panels or by using ActionScript code on objects or keyframes in a timeline.
| Note | You can add additional instances of your component to your document by dragging it from your Library panel onto the Stage instead of from the Component panel. |
You can also add a component to your movie by using the MovieClip.attachMovie() method in ActionScript after the instance is added to your library. An example of adding a Button component to the Stage and setting a few properties using ActionScript is as follows. (This code uses standard ActionScript 1.0 syntax.)
var cbt = attachMovie("Button", "cbt ", 1); cbt.label = "Music";
This creates an instance of a push button, labeled "Music," on the stage. You can also use ActionScript 2.0 to create a new component instance:
import mx.controls.Button; var cbt:Button = createClassObject(Button, "cbt", 1, {label: "Test Button"});
| Cross-Reference | For more information on using the MovieClip object and attachMovie(), refer to Chapter 25, "Controlling Movie Clips." |
Категории