当前位置: 动力学知识库 > 问答 > 编程问答 >

Displaying custom cursor in the full screen mode - Flex 3.0

问题描述:

I am having trouble displaying a custom cursor in the full screen mode of my flex application. How can I do this?

网友答案:

CursorManager.removeCursor() method removes a cursor from the cursor list.

If the cursor being removed is the currently displayed cursor, the CursorManager displays the next cursor in the list, if one exists. If the list becomes empty, the CursorManager displays the default system cursor.

I can't find a way to add a removed cursor back to the cursor list other than calling the setCursor again. The following code works in normal as well as full screen mode. There's got to be a better way, because the customID is incremented in each call - but at least it works fine.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" 
    xmlns:local="*" >
    <mx:Button label="Custom" click="onCustomClick();"/>
    <mx:Button label="Default" click="onDefaultClick();"/>
    <mx:Button label="Go Fullscreen" 
        click="stage.displayState = StageDisplayState.FULL_SCREEN;"/>
    <mx:Script>
        <![CDATA[
            import mx.managers.CursorManager;

            [Embed(source="cursor.png")]
            public var CursorPNG:Class;

            private var customID:int;

            private function onCustomClick():void
            {
                customID = CursorManager.setCursor(CursorPNG);
            }
            private function onDefaultClick():void
            {
                CursorManager.removeCursor(customID);
            }

        ]]>
    </mx:Script>
</mx:Application>
网友答案:

I am using the same method you are talking about. I am calling the method which changes the cursor on the RollOver event of mouse on a Canvas. Then I call the restore cursor method on RollOut event which removes the previously assigned cursor and shows the system's default one. It all works fine in normal mode. Custom cursor appears and disappears on roll over and out of the Canvas. But when I switch the canvas to full screen mode, the custom cursor only appears only for a moment or so. And then it disappears. No cursor on the screen. If you move out of the Canvas, the system's default cursor is only visible then.

分享给朋友:
您可能感兴趣的文章:
随机阅读: