var yellow:uint = 0xFFFF00; // draws yellow circle with(graphics) beginFill(yellow), drawCircle(100,100,50); // invert the color using XOR assignment // yellow becomes 0x0000FF yellow ^= 0xFFFFFF; // draws blue circle with(graphics) beginFill(yellow), drawCircle(200,100,50);
Just a fun use for XOR. You could also do it without XOR assignment:
with(graphics) beginFill(yellow ^ 0xFFFFFF), drawCircle(200,100,50);
Playing a little with bitwise operators is a good way to make sure you understand them. Try tweaking this trace statement:
trace((0x543210 ^ 0xFFFFFF).toString(16));
If you’d like to read about bitwise operators, I recommend wikipedia’s article.