5 Replies Latest reply on Mar 22, 2007 7:58 AM by kglad

    Draggable Movie Clips

    Social Psyence
      hey there, is it possible to make a draggable text box that can later have input text entered into it. You can't enter type in the box when the movie clip it resides in becomes draggable.

      I've pinned the ._x and ._y values of the text box to a draggable move clip so it sort of "follows" it when it's released, but it doesn't look very nice at all.

      Surely there is some other way? Any ideas are most welcome..
        • 1. Re: Draggable Movie Clips
          kglad Adobe Community Professional & MVP
          you can enter text into a draggable textfield. you just can't use mouse handlers on the parent movieclip.

          for example, using a hitTest() between the mouse and movieclip (onMouseDown would be good) to initiate a startDrag() should be fine. use an onMouseUp to stopDrag().
          • 2. Re: Draggable Movie Clips
            Social Psyence Level 1
            Maybe I don't quite understand. So which movie clip is being made dragable when you say not the parent, an isntance of the movie clip? Here's the code I currently have.

            I'm pretty much a noob at ActionScripting, learning stuff as I encounter each problem. So you are recommending that instead of using the onPress I use hitTest()? I'm not familiar with function but I'll look it up. Any more info you can give will be most appreciated.
            • 3. Re: Draggable Movie Clips
              kglad Adobe Community Professional & MVP
              correct. you cannot use onPress and onRelease handlers or your textfield in mcDrag cannot respond to the mouse. (you could, however, use the Selection class and its setFocus() method to allow text input upon your movieclip's release. that may, or may not be satisfactory.)
              • 4. Re: Draggable Movie Clips
                Social Psyence Level 1
                Sorry for the delayed repsponse, very busy these days. So with the setFocus() method, this can be invoked during the the movie clip's onRelease event, meaning that I can drag the movieclip, and when the user lets go, it allows for text entry?

                But I'm guessing that means when the .swf first loads they couldn't enter text. They would have to click and move the clip first?
                • 5. Re: Draggable Movie Clips
                  kglad Adobe Community Professional & MVP
                  you're not limited to one block of code. you can still code for your textfield to have focus when the frame containing your textfield plays: