flex中如何实现鼠标样式用图片代替,急急急!!!
请教大家,在指定的区域中,让鼠标以其它的图片代替怎么实现,最好有代码,谢谢!
[解决办法]
代码如下:
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> <mx:Script> <![CDATA[ import mx.controls.Button; import mx.managers.CursorManager; import flash.events.*; // 换成你想要的图片 [Embed(source="assets/hourglass.swf")] public var HourGlassAnimation:Class; private function mouseOverHandler(event:MouseEvent):void { CursorManager.setCursor(HourGlassAnimation); } private function mouseOutHandler(event:MouseEvent):void { CursorManager.removeCursor( CursorManager.currentCursorID ); } ]]> </mx:Script> <mx:Panel paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10" horizontalAlign="center" verticalAlign="middle" width="200" height="200" mouseOver="mouseOverHandler(event)" mouseOut="mouseOutHandler(event)" title="Custom cursor"> </mx:Panel></mx:Application>
[解决办法]
[Bindable][Embed(source="img/157.jpg")]public var cur:Class;private function initCursor(event:Event){ CursorManager.setCursor(cur);}