THE SECOND COMPONENT - COLOR SELECTOR

The requirement specification is still on the way, hopefully can release a draft version within this week. It is quite difficult to write down all the requirements so as the application flow.

Besides the requirement specification, another new Flash class is in psuedo code stage now. This is another important class / component in my FYP application, the color selector. It is used very widely for the user to choose their favorites when building their web.

A problem is found when designing which is quite interesting.

When I want to change a movieclip’s color inside Flash, I have to say something like setRGB (hex_value). In Flash this hex value have to be written in the form of 0xFFCC66. What if I want to use a loop to generate a set of this color??

A normal solution provided by Macromedia Flash Help

var r:Number = new Number(250);
var g:Number = new Number(128);
var b:Number = new Number(114);
var rgb:String = “0x”+ r.toString(16)+g.toString(16)+b.toString(16);

An intelligent solution provided by O’Reilly ActionScript Cookbook

red = 100;
green = 100;
blue = 100;
rgb = (red << 16) | (green <<  | (blue);

Where << is a bitshift left operator =.=||

Or course… I am a normal person too… However I will learn (copy XD) the intelligent method~