A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] Change my cursor

  1. #1
    Vaster Graphics
    Join Date
    Jun 2006
    Posts
    165

    [F8] Change my cursor

    Hey,

    Does anyone have some as script that I could use to change my cursor(mouse pointer) to my hand.png? The only problem is I only want it to happen on my button. No where else. I am trying to show that you can drag the button around the screen.

    Thanks in advance.

  2. #2
    Senior Mamba austriaman's Avatar
    Join Date
    Aug 2004
    Location
    Somewhere over the rainbow
    Posts
    472
    I'll assume you have a button (instance name: btn) and a movie clip for your mouse (instance name: mouse_mc) on your root-timeline. The first frame of mouse_mc (framelabel: inactive ) is empty, the second one (framelabel: active ) holds your hand.png bitmap. Equip both frames with a
    stop(); - action. Now, attach the following code to the appropriate frame of your root-timeline:
    code:
    _root.mouse_mc.swapDepths(1000);
    _root.onEnterFrame = function() {
    mouse_mc._x = _root._xmouse;
    mouse_mc._y = _root._ymouse;
    };
    _root.btn.onRollOver = function() {
    Mouse.hide();
    _root.mouse_mc.gotoAndStop("active");
    };
    _root.btn.onRollOut = function() {
    Mouse.show();
    _root.mouse_mc.gotoAndStop("inactive");
    };

    Hope this helps.
    aut.

  3. #3
    Vaster Graphics
    Join Date
    Jun 2006
    Posts
    165

    Thanks,

    Hey,

    Works great. The only problem is when I put the text box and button which has the hand code in a MC it doesn't work. I assume this is cause my action says _root. What would I change _root to ?

    Thanks,

  4. #4
    Senior Member
    Join Date
    Apr 2006
    Posts
    1,059
    _root.holderClipInstanceName.myBtn should work
    but if you do that you should actually change it to this

    _root.onEnterFrame = function() {
    mouse_mc._x = Math.Floor( _root._xmouse)
    mouse_mc._y = Math.Floor(_root._ymouse);
    };

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