?
- <?xml?version="1.0"?encoding="utf-8"?>? ?
-
<s:Application?xmlns:fx="http://ns.adobe.com/mxml/2009"???? ?
-
???????????????xmlns:s="library://ns.adobe.com/flex/spark"???? ?
-
???????????????xmlns:mx="library://ns.adobe.com/flex/halo"?minWidth="1024"?minHeight="768">?? ?
- ???? ?
- ? ?
-
????<fx:Script>?
-
????????<![CDATA[ ?
- ????????????import?mx.core.BitmapAsset;???? ?
- ????????????//?自定义的鼠标元素??? ?
- ????????????var?myCursor:Sprite?=?new?Sprite();??? ?
- ????????????protected?function?button1_clickHandler(event:MouseEvent):void??? ?
- ????????????{?????????????????? ?
- ????????????????//?嵌入图像元数据??? ?
- ????????????????[Embed(source?=?"1222.png")]??? ?
- ????????????????var?cur1:Class;??? ?
- ????????????????//?把图片设置到自己的鼠标元素上去??? ?
- ????????????????var?cursorStyle1:BitmapAsset?=?new?cur1()?as?BitmapAsset;??? ?
- ????????????????myCursor.addChild(cursorStyle1);??? ?
- ????????????????//?添加stage的mousemove监听器??? ?
- ????????????????stage.addEventListener(MouseEvent.MOUSE_MOVE,?mousemoveHandler);??? ?
- ????????????????//?添加sprite对象并隐藏鼠标??? ?
- ????????????????stage.addChild(myCursor);??? ?
- ????????????????Mouse.hide();??? ?
- ????????????}??? ?
- ????????????//?监听函数??? ?
- ????????????protected?function?mousemoveHandler(event:MouseEvent):void??? ?
- ????????????{??? ?
- ????????????????myCursor.x?=?event.stageX;??? ?
- ????????????????myCursor.y?=?event.stageY;??? ?
- ????????????} ?
- ????????]]>?
-
????</fx:Script>?
-
????<s:Button?x="274"?y="177"?label="按钮"?click="button1_clickHandler(event)"/>? ?
-
</s:Application>