Skip to main content
Participant
March 9, 2015
Question

setting X axis/stage limit

  • March 9, 2015
  • 1 reply
  • 268 views

Hi, I want to do  righr/left button controlled movieclip but dont know how to set X axis limit, the movieclip dont leave stage. Want the movieclip move only move to right or left side.  Will anybody help me?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
March 9, 2015

You need to make use of conditional code that checks the current x property  to see if moving further will vilate the limit and if so you skip the movement.

In your right movement code it would be something like...

if(movieclip.x + stepsize < right_side_limit){

        movieclip.x += stepsize;

} else {

        // do nothing (or something else )

}

Similar code would be used in the left direction movement code.

Participant
March 9, 2015

Thanks a lot for help and my second question, the movieclip can have only one registration point or more than one?