3 Replies Latest reply on Oct 22, 2009 1:42 PM by Ned Murphy


    adamhood Level 1

      if i wanna set the postion of a button to the position of a character on screen  and when the character moves so deos the buttons  what would be the best way to do that?

        • 1. Re: buttons
          Ned Murphy Adobe Community Professional & MVP

          Whatever code you have that moves the character should also be involved with moving the button.  What makes the character move?

          • 2. Re: buttons
            adamhood Level 1

            my first problem is setting the position of the button i keep getting a actionscript processing error here is that code: upButton._x = origX;
            upButton._y = origY;

            • 3. Re: buttons
              Ned Murphy Adobe Community Professional & MVP

              Are origX and origY genuine variables?  Is upButton the instance name you assigned to the button via the Properties panel?


              If you are getting an error message, it may provide some useful info so share it if you can.


              What you should do is put some trace code in to make sure things are what you expect them to be.  If you are not familiar with the trace function, it is a very handy function that is useful for troubleshooting.  It traces (displays) whatever you command it to in the output panel.  So in front of those two lines of code you could use ...


              trace("origX = "+origX);

              trace("origY = "+origY);

              trace(upButton); // will display something like _level0.upButton


              upButton._x = origX;
              upButton._y = origY;


              Those traces will tell you if any of those values aren't what you expect they should be

              1 person found this helpful