ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > ColorTransform (flash.geom.ColorTransform) > rgb (ColorTransform.rgb property) | |||
public rgb : Number
The RGB color value for a ColorTransform object.
When you set this property, it changes the three color offset values (redOffset, greenOffset, and blueOffset) accordingly, and it sets the three color multiplier values (redMultiplier, greenMultiplier, and blueMultiplier) to 0. The alpha transparency multiplier and offset values do not change.
Pass a value for this property in the format: 0xRRGGBB. RR, GG, and BB each consist of two hexadecimal digits that specify the offset of each color component. The 0x tells the ActionScript compiler that the number is a hexadecimal value.
Availability: ActionScript 1.0; Flash Player 8
The following example creates the ColorTransform object colorTrans and adjusts its rgb value to 0xFF0000.
import flash.geom.ColorTransform;
import flash.geom.Transform;
var colorTrans:ColorTransform = new ColorTransform();
trace(colorTrans.rgb); // 0
colorTrans.rgb = 0xFF0000;
trace(colorTrans.rgb); // 16711680
trace("0x" + colorTrans.rgb.toString(16)); // 0xff0000
var rect:MovieClip = createRectangle(20, 80, 0x000000);
var trans:Transform = new Transform(rect);
trans.colorTransform = colorTrans;
function createRectangle(width:Number, height:Number, color:Number, scope:MovieClip):MovieClip {
scope = (scope == undefined) ? this : scope;
var depth:Number = scope.getNextHighestDepth();
var mc:MovieClip = scope.createEmptyMovieClip("mc_" + depth, depth);
mc.beginFill(color);
mc.lineTo(0, height);
mc.lineTo(width, height);
mc.lineTo(width, 0);
mc.lineTo(0, 0);
return mc;
}
|
|
|
|