Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

setting X axis/stage limit

New Here ,
Mar 08, 2015 Mar 08, 2015

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?

TOPICS
ActionScript
244
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 08, 2015 Mar 08, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 09, 2015 Mar 09, 2015
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines