在FLEX中自定义光标造型

其实还是很简单的做法,跟以往的惯例一样,贴出关键代码,稍作解释。有问题的可以到原站点去下载源代码

http://www.harrisfamily.net.nz/devblog/index.cfm/2007/9/10/Simple-Dynamic-Cursor-Example-in-Flex2-With-source-code



< mx:Panel

title
= " CircleCursor "





mouseOver
= " setCursor(Circle); " // 设置光标

mouseOut
= " clearCursor(); "

height
= " 250 "

width
= " 250 "

/>

importmx.managers.CursorManager;

private functionsetCursor(cursorClass:Class = null ): void

... {

CursorManager.setCursor(cursorClass);
//关键就是使用光标管理器

}




private functionclearCursor(): void

... {

CursorManager.removeAllCursors();

}


在看看不能忽视的CUSORCLASS,只贴构造函数了

public functionCircle()

... {

this.graphics.lineStyle(1,0x000000,1);

this.graphics.drawCircle(0,0,10);

super();

}




效果图

http://dl2.csdn.net/down4/20070910/10213114718.swf

你可能感兴趣的:(.net,Flex)