This action scripts works fine for me; however, I want to have a thick line right behind the buttons and I would like to make the buttons to move around until the mouse is on that thick line. This is the part I am stucked at, and I hope there is someone who might help me on this. Thanks a lot!!!
the thick line should be a button or a movieclip. if a button (or movieclip using button actions) you would want to use onRollOver/onDragOver and onRollOut/onDragOut for the mouse being over it, otherwise hitTest.
but basically, you test for when the mouse is over the thick line, and when it is,
but first you have to take the this.onEnterFrame = this.moveToMouse in the mouse move, otherwise it will re-assign the onEnterFrame everytime you move the mouse which you dont want. But this will delete the frame movement function associated witht the enterframe stopping the movement. Target can still be calced on mouseMove, but that doesnt matter since its not moving the clip when your mouse goes off the thick line. To re-instate the movement, simply reset the onEnterFrame:
Thank you so much for replying my question, Senocular! I had a tough time figuring out how to do it myself. I am slowing getting hand on actionscript. Anyway, I still have a question on the instruction that you gave me. When you told me to make the thickLine as a button, and use onRollOver/onDragOver and onRollOut/onDragOut for the mouse being over it, otherwise hitTest. Do you mean to put the actionscript below in the button action??? Thank you so much for you help!!!