Home>

You can use your own mouse cursor image, but I want to display a different mouse cursor image only when the mouse is over the image that is set as a button.

Code that implements the mouse cursor

I created it with ParaFla !, put the mouse cursor image in the sprite, and wrote the following code in the sprite

// Get mouse coordinates and apply them to image coordinates
onClipEvent (load) {
Mouse.hide ();
}
-
onClipEvent (enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
Tried

I understand that I can write the process when the mouse cursor is over the button in the code below, but I don't know how to replace the image ...

on (rollOver) {
  // Process here
}


I think that it is a theme that is too minor, but I couldn't find a way to switch to the mouse cursor image I prepared even after examining various things, so please answer someone

By the way, is there anyone else who is trying to make something with Flash now?

  • Answer # 1

    Because I have never used ParaFla !, I will write only the outline of how this can be achieved.
    (ParaFla! Seems to be a little different from Flash. Is it closer to as2 than as3?)

    The cursor clip is
    Normal image in the first frame,
    Image when touching the button in the second frame
    Is placed.

    Normally it will stop () in one frame.
    Move the frame to 2 only when it touches the button.
    When it comes off the button, return the frame to 1.

    For cursor clips,
    Write a function that sets the frame to 1 or 2.

    For the

    button,
    Write hitTestPoint () to watch if the mouse pointer is over you.
    When the mouse pointer comes over you, call the function you wrote in the cursor clip,
    Move the cursor frame to 2.
    When the pointer comes off, move the frame to 1.

    without using hitTestPoint ()
    I think that you can use hitTestObject () which can judge collision between objects.
    In this case, the current collision object is monitored on the clip side of the cursor.
    If the currently colliding object is the one (button clip),
    Advance your frame to 2.
    When the collision disappears, set it back to 1.

    *

    I still use flash (animateCC) because of its affinity with animation.
    I would like adobe to do my best, because it will be really troubled if it disappears.