Search code examples
flashactionscript-3actionscript-2flash-cs3

ActionScript 2.0 List Component - Change pointer icon to hand for list items


I am working on an older Flash project created in CS3 ActionScript 2.0 How can I make the pointer cursor change to the hand when hover over a list item?

_root.slidePanel.myList

'myList' is the list. I have traced out the contents of the List MC and it has a child MC called 'content_mc'. I assumed this was the object containing all of my list items but the only members of this MC I can see (when tracing them out) are 'setRGB' and 'searchKey'.

Can someone offer some help?


Solution

  • Not sure about AS2, but this should work in AS3. If you don't want AS3 answers, you may want to untag 'actionscript-3'

    To get a custom cursor you'll need to attach MouseEvent.MOUSE_ENTER and MouseEvent.MOUSE_LEAVE to whatever it is you want to have the custom cursor.

    function mouseEntered(e:MouseEvent):void
    {
     Mouse.hide();
     stage.addEventListener(MouseEvent.MOUSE_MOVE, moveCursor);
     //create mouse cursor and add to stage
    }
    
    function mouseLeft(e:MouseEvent):void
    {
     Mouse.show();
     stage.removeEventListener(MouseEvent.MOUSE_MOVE, moveCursor);
     //remove mouse cursor from stage
    }
    
    function moveCursor(e:MouseEvent):void
    {
     // move the mouse cursor to wherever the mouse is.
    }
    

    This is one way of handling a custom cursor. You'll need to design a cursor that can be moved around the stage as the mouse is moved.

    EDIT to add:
    In AS3, Sprites have a property: useHandCursor that can be set to true to show the pointer when hovered over.