문제

I want to get the a different cursor to show up for my custom cursor and this is the code I have so far. I've created the function but I am not sure where to go from here.

Ideally I would like to switch one cursor our for another, or use a different frame within the cursor's timeline. Please help if you can.

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;

var myCursor:Sprite;

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

function init()
    {
        Mouse.hide();


        myCursor = new CursorClass();
        myCursor.mouseEnabled = false;
        myCursor.visible = false;


        addChild(myCursor);

        stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
        stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
        stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    }

    function mouseMoveHandler(evt:MouseEvent):void
    {
        myCursor.visible = true;
        myCursor.x = evt.stageX;
        myCursor.y = evt.stageY;
    }

    function mouseDownHandler(evt:MouseEvent):void
    {

    }

    function mouseLeaveHandler(evt:Event):void
    {
        myCursor.visible = false;
    }

init();
도움이 되었습니까?

해결책

If myCursor have timeline with different shape for cursor than in mouseDownHandler set myCursor.gotoAndStop(2). Else you can change myCursor with instance of some MovieClip from library.

다른 팁

This topic looks like :

Flex 3: How can I change the Mouse Cursor when mousing over a Text Input?

Perhaps it will help you...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top