Jump to content

moving Mc on x-axes


PlaviZG

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...