我想为我的自定义光标显示一个不同的光标,这是我到目前为止的代码。我已经创建了这个函数,但我不确定从这里去哪里。
理想情况下,我想将一个光标切换到另一个光标,或者在光标的时间轴内使用不同的帧。如果可以的话请帮忙。
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();