Jump to content

moving Mc on x-axes


PlaviZG
 Share

Recommended Posts

  • 2 weeks later...
  • 3 weeks later...
Each object on the stage has _x and _y properties which hold the coordinates of the origin.
In As3.0 it's called x and y. So let's say you have a button on stage called button_left and a button called button_right, the code would be similar to this:
button_left.addEventListener(MouseEvent.CLICK,moveLeft);button_right.addEventListener(MouseEvent.CLICK,moveRight);function moveLeft(event:MouseEvent){  movieclipyouwantedtomove.x += -3; // 3 is the speed of traveling}function moveRight(event:MouseEvent){  movieclipyouwantedtomove.x += 3; // 3 is the speed of traveling}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...