Set x,y Coordinates with ActionScript

Position ball2

That was easy enough:

  1. We started by referencing a MovieClip instance name: ball1
  2. We use a period . to separate elements (this is called dot syntax)
  3. We used x for the x position property
  4. We set the new value of x to be equal to 100
  5. We close our statment with a semicolon

Now let's try to set the x and y position of ball2 to (150,200). I'm sure you can do it on your own:

Test the movie. ball1(an instance of ball_mc) should still move to the right, and ball2 (an instance of ball_mc) should move to the right and down:

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Remember: this only works when you TEST the movie using CTRL+ENTER.