Reputation: 76093
In an online mapping application I'm doing in Flex 3 I need a cursor for certain operations that has XOR coloring with the background.
i.e. it is always the "negative" color of whatever pixels it stands above off (white on black, red on green, etc.).
Can this be done with Flex? (Can I roll my own programmatic cursor?)
Upvotes: 1
Views: 1561
Reputation: 1838
Take a look at displayObject.blendMode property: http://livedocs.adobe.com/flex/3/langref/flash/display/BlendMode.html#INVERT
Use a custom cursor with that property set to BlendMode.INVERT
Update: here is the solution
Cursor class:
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();
}
}
}
Usage:
import mx.managers.CursorManager;
import test.InvertCursor;
private function setInvertCursor():void {
CursorManager.setCursor(InvertCursor);
}
Upvotes: 2
Reputation: 872
Sure, you can have your own cursor: http://www.switchonthecode.com/tutorials/flex-custom-cursor-tutorial
Hope that helps!
Upvotes: 1