在我在 Flex 3 中进行的在线地图应用程序中,我需要一个光标来执行某些具有与背景进行异或着色的操作。
即它始终是其上方的任何像素的“负”颜色(黑色上的白色,绿色上的红色等)。
这可以用 Flex 完成吗?(我可以滚动我自己的编程光标吗?)
在我在 Flex 3 中进行的在线地图应用程序中,我需要一个光标来执行某些具有与背景进行异或着色的操作。
即它始终是其上方的任何像素的“负”颜色(黑色上的白色,绿色上的红色等)。
这可以用 Flex 完成吗?(我可以滚动我自己的编程光标吗?)
看看 displayObject.blendMode 属性: http: //livedocs.adobe.com/flex/3/langref/flash/display/BlendMode.html#INVERT
使用该属性设置为 BlendMode.INVERT 的自定义光标
更新:这是解决方案
光标类:
package test
{
import flash.display.BlendMode;
import flash.display.Graphics;
import flash.display.Sprite;
public class InvertCursor extends Sprite
{
public function InvertCursor()
{
super();
draw();
blendMode = BlendMode.INVERT;
}
public function draw():void {
var g:Graphics = graphics;
g.clear();
g.beginFill(0);
g.lineStyle(0);
g.drawCircle(0, 0, 10);
g.endFill();
}
}
}
用法:
import mx.managers.CursorManager;
import test.InvertCursor;
private function setInvertCursor():void {
CursorManager.setCursor(InvertCursor);
}
当然,您可以拥有自己的光标: http ://www.switchonthecode.com/tutorials/flex-custom-cursor-tutorial
希望有帮助!