import fl.motion.Color; var ar = new Array(11); for (var i:Number = 0; i <= 10; i++) { ar[i] = this.addChild(new colorExperiment()); ar[i].x = 25 * i; } var c:Color = new Color(); c.setTint(0x0000FF, 1); var c2:Color = new Color(); c2.setTint(0xFF0000, 1); ar[0].transform.colorTransform = c; ar[10].transform.colorTransform = c2; --------------------------------------------------------------------------- *** Below here is what we did in class on Wednesday, March 12th *** --------------------------------------------------------------------------- import fl.motion.Color; var ar = new Array(11); for (var j:Number = 0; j <= 10; j++) { ar[j] = this.addChild(new colorExperiment()); ar[j].x = 25 * j; } var c:Color = new Color(); c.setTint(0x0000FF, 1); var c2:Color = new Color(); c2.setTint(0xFF0000, 1); ar[0].transform.colorTransform = c; ar[10].transform.colorTransform = c2; for (var i:Number = 1; i <= 9; i++) { var newColor:uint; newColor = Color.interpolateColor(0x0000FF, 0xFF0000, i / 10); c.setTint(newColor, 1); ar[i].transform.colorTransform = c; trace(newColor.toString(16)); } /* Here are the colors that interpolateColor() method of the Color class came up with on the gradient from RED to BLUE, from 0x0000FF to 0xFF0000 -- -- -- -- 0x0000FF to 0xFF0000 RRGGBB RRGGBB RR = red RGB graphics -- -- GG = green BB = blue FF = 255 = 11111111 16 10 2 FF is base 16, hexadecimal, thus the 0x in front of the - - RRGGBB digits. 255 is base ten or decimal. 11111111 is base two or binary. Here are the 9 colors between perfect BLUE and perfect RED. 1900E5 <---- mostly BLUE (E5) with a little bit of RED (19) 3300CC 4C00B2 660099 7F007F <---- RED = 7F = BLUE = 7F (Note 7F is 127 and FF is 255) 990066 B2004C 255 CC0032 ----- = 127.5 E50019 2 Finally, the last entry is mostly RED and a little bit of BLUE. E5 19 Notice how the colors are mirror images of each other too! 0000FF 1900e5 3300cc 4c00b2 660099 7f007f 990066 b2004c cc0032 e50019 FF0000