03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

When you set this property, it changes the three color offset values (redOffset,<br />

greenOffset, <strong>and</strong> blueOffset) accordingly, <strong>and</strong> it sets the three color multiplier values<br />

(redMultiplier, greenMultiplier, <strong>and</strong> blueMultiplier) to 0. The alpha transparency<br />

multiplier <strong>and</strong> offset values do not change.<br />

Pass a value for this property in the format: 0xRRGGBB. RR, GG, <strong>and</strong> BB each consist of two<br />

hexadecimal digits that specify the offset of each color component. The 0x tells the<br />

<strong>ActionScript</strong> compiler that the number is a hexadecimal value.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Example<br />

The following example creates the ColorTransform object colorTrans <strong>and</strong> adjusts its rgb<br />

value to 0xFF0000.<br />

import flash.geom.ColorTransform;<br />

import flash.geom.Transform;<br />

var colorTrans:ColorTransform = new ColorTransform();<br />

trace(colorTrans.rgb); // 0<br />

colorTrans.rgb = 0xFF0000;<br />

trace(colorTrans.rgb); // 16711680<br />

trace("0x" + colorTrans.rgb.toString(16)); // 0xff0000<br />

var rect:MovieClip = createRectangle(20, 80, 0x000000);<br />

var trans:Transform = new Transform(rect);<br />

trans.colorTransform = colorTrans;<br />

function createRectangle(width:Number, height:Number, color:Number,<br />

scope:MovieClip):MovieClip {<br />

scope = (scope == undefined) ? this : scope;<br />

var depth:Number = scope.getNextHighestDepth();<br />

var mc:MovieClip = scope.createEmptyMovieClip("mc_" + depth, depth);<br />

mc.beginFill(color);<br />

mc.lineTo(0, height);<br />

mc.lineTo(width, height);<br />

mc.lineTo(width, 0);<br />

mc.lineTo(0, 0);<br />

return mc;<br />

}<br />

toString (ColorTransform.toString method)<br />

public toString() : String<br />

Formats <strong>and</strong> returns a string that describes all of the properties of the ColorTransform object.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

ColorTransform (flash.geom.ColorTransform) 447

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!