Set x,y Coordinates with ActionScript
Position ball2
That was easy enough:
- We started by referencing a MovieClip instance name: ball1
- We use a period . to separate elements (this is called dot syntax)
- We used x for the x position property
- We set the new value of x to be equal to 100
- 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:
Remember: this only works when you TEST the movie using CTRL+ENTER.