在Flex 3中,我在做一個在線地圖應用程序。我需要一個光標,用於某些具有背景XOR着色的操作。Flex鼠標光標「xor」顏色
也就是說,它始終是上面關閉的任何像素(「白底黑」,「紅底綠」等)的「負」顏色。
這可以用Flex來完成嗎? (我可以把我自己的編程光標?)
在Flex 3中,我在做一個在線地圖應用程序。我需要一個光標,用於某些具有背景XOR着色的操作。Flex鼠標光標「xor」顏色
也就是說,它始終是上面關閉的任何像素(「白底黑」,「紅底綠」等)的「負」顏色。
這可以用Flex來完成嗎? (我可以把我自己的編程光標?)
看看displayObject.blendMode屬性:http://livedocs.adobe.com/flex/3/langref/flash/display/BlendMode.html#INVERT
使用與該屬性設置爲BlendMode.INVERT
更新自定義光標: 這裏是解決
Cursor類:
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
希望幫助!
恐怕這並不清楚:設置自定義光標時唯一相關的參數是表示光標圖像的類(並且我只從CursorManager獲得ID)。 如何/在哪裏設置混合模式? – Dan 2010-01-04 11:35:18
更新我的答案,包括解決方案,而不僅僅是提示。 – Hrundik 2010-01-04 12:21:02