Change cursor of a pop out panel
how can i change the cursor when my cursor is only within this pop out panel and not in the main stage ?
private function launchPopUp(e:MouseEvent):void
{
panel = new Panel();
panel.width 开发者_如何学运维= stage.stageWidth;
panel.height = stage.stageHeight;
panel.setStyle("borderAlpha", 1);
PopUpManager.addPopUp(panel, this, true);
PopUpManager.centerPopUp(panel);
}
Would appreciate if anyone could help.
You can use the following code to change the mousecursor. The trick is to hide the mousecursor and replace it with a sprite.
function launchPopUp(e:MouseEvent):void
{
panel = new Panel();
panel.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveFunc);
panel.addEventListener(MouseEvent.MOUSE_OUT, mouseOutFunc);
panel.width = stage.stageWidth;
panel.height = stage.stageHeight;
panel.setStyle("borderAlpha", 1);
PopUpManager.addPopUp(panel, this, true);
PopUpManager.centerPopUp(panel);
}
function mouseMoveFunc(e:MouseEvent):void
{
Mouse.hide();
customMouseSprite.visible = true;
customMouseSprite.x = e.stageX;
customMouseSprite.y = e.stageY;
}
function mouseOutFunc(e:MouseEvent):void
{
Mouse.show();
customMouseSprite.visible = false;;
}
You also need to call the mouseOutFunc when the popup is closed. the customMouseSprite has to be on the top layer of your stage. customMouseSprite can either be a sprite or movieclip (in fact any displayobject).
精彩评论