1 Reply Latest reply on Jul 6, 2007 3:55 AM by dingsword

    drag & drop

    absurd29
      I have several MCs on stage that users can drag & drop with the mouse. How can I also give the option of moving the MCs by using the 4 arrow keys(up,down etc)?
      I can't put this code on them all as they'll all move at once:
      bloc1_mc.onEnterFrame = function() {
      if (Key.isDown(Key.RIGHT)) {
      this._x += 10;
      } else if (Key.isDown(Key.LEFT)) {
      this._x -= 10;
      }
      };
      How can I say which one they want to move?
      Thanks for any help :-)
        • 1. Re: drag & drop
          dingsword
          thy this
          var buttonid : Number ;
          var mcnum : Number ;
          for (var i:Number = 1;i<=mcnum;i++){
          eval(["bloc"+i+"_mc"]).id = i;
          eval(["bloc"+i+"_mc"]).onPress = function() {
          buttonid = this.i ; // get the button that user pressed
          } //end function
          }//end for

          then use the buttonid you can do what you want to do