segunda-feira, 7 de novembro de 2011

Mudar icone do mouse Flex 3


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle"
    horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" viewSourceURL="srcview/index.html">
    <mx:Script>
        <![CDATA[
            import mx.controls.Button;
            import mx.managers.CursorManager;
            import flash.events.*;
            
            private var cursorID:Number = 0;
            // Embed the cursor symbol.
            [(source="aircursor.png")]
            private var waitCursorSymbol:Class;           

            private function setCursor(cursorType:String):void 
            {
                if (cursorType == "normal") {
                    CursorManager.removeAllCursors();
                    CursorManager.removeBusyCursor();
                } else if (cursorType == "busy") {
                    CursorManager.removeAllCursors();
                    CursorManager.setBusyCursor();
                } else if (cursorType == "custom") {
                    CursorManager.removeAllCursors();                    
                    cursorID = CursorManager.setCursor(waitCursorSymbol);
                }
            }
        ]]>
    </mx:Script>
    
    <mx:Button label="Normal Cursor" color="white" textRollOverColor="white" click="setCursor('normal')"/>
    <mx:Button label="Default Busy Cursor" color="white" textRollOverColor="white" click="setCursor('busy')"/>
    <mx:Button label="Custom Busy Cursor" color="white" textRollOverColor="white" click="setCursor('custom')"/>

</mx:Application>



Vitor Yudi Hansen