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

  1. Created a new Flash file called ball_addChild
  2. Cleared the Stage and previous Actions
  3. Used the Properties window to Export for ActionScript with the Class name ball
  4. Created a new instance of ball with the name ball1
  5. Used addChild to place ball1 on the Stage at default (0,0)
  6. 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: