Add MovieClip with ActionScript
Review
Whoa! That was some funny work just to move a single MovieClip into position. It's all part of the process. You're learning. Soon, you'll be master of the AS3 universe.
What We Did
- Created a new Flash file called ball_addChild
- Cleared the Stage and previous Actions
- Used the Properties window to Export for ActionScript with the Class name ball
- Created a new instance of ball with the name ball1
- Used addChild to place ball1 on the Stage at default (0,0)
- Set (x,y) position for ball1
Important ActionScript
var ball1:ball = new ball();
ball1.x=100;
ball1.y=150;
addChild(ball1);
Self-Check for Understanding
In the example below, why would we not be able to see myShip on the stage: