A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Mouse Avoid ??

  1. #1
    Member
    Join Date
    May 2001
    Posts
    37
    Is there a command for mouse avoid? Specifically, I've got a button I want to move whenever the cursor passes over it.

    thanks!!

    Ben

  2. #2
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923

    hitTest

    Try this:
    make your button, and then put it inside a new movie clip. then use the below code on that movie clip.

    Code:
    onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
    if (this._x<_root._xmouse) {
    
    this._x-=2;
    } else if (this._x>=_root._xmouse) {
    this._x+=2;
    }
    if (this._y<_root._ymouse) {
    this._y-=2;
    } else if (this._y>=_root._ymouse) {
    this._y+=2;
    }
    }
    }
    hope it helps.

    psx
    [Edited by psychlonex on 08-27-2001 at 11:41 AM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center