flex中自定义 Cursor

本文介绍如何使用Adobe Flex创建自定义光标。通过拖放Button和Panel组件,并编写AS3代码来显示和移除自定义光标。
首先在fb3中拖入两个button 和一个Panel :
代码如下
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  width="350" height="200" layout="absolute"> 
<mx:Panel title="Having Fun with Cursors"    x="0" y="0" width="100%" height="100%" layout="absolute">   
<mx:Button label="Show Cursor"      x="10" y="59" width="115"/>   
<mx:Button label="Remove Cursor"      x="205" y="59" width="115"/>
 </mx:Panel>

下面为这两个分别增加单击事件分别是showCursor  和 removeCursor:

<mx:Button label="Show Cursor" click="showCursor()"  x="10" y="59" width="115"/><mx:Button label="Remove Cursor" click="removeCursor()"  x="205" y="59" width="115"/>

下面就添加as3 code吧 ! 一个Script  标签 和 给这个Cursor添加函数
<mx:Script>
<![CDATA[
 import mx.managers.CursorManagerPriority; 
import mx.managers.CursorManager;   
[Embed("/cursors/cc.png")] 
 private var customCursor:Class;  
 private function showCursor():void  {   
CursorManager.setCursor( customCursor, CursorManagerPriority.HIGH, 3, 2); 
 }   
private function removeCursor():void  {  
 CursorManager.removeAllCursors(); 
}
]]>
</mx:Script>
好 ~ 一个自定义的Cursor完成拉  可以造出自己喜欢的Cursor拉!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值