
Color.getRGB() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
496
|
ActionScript Language Reference
brightnessTransform.rb = -30;
brightnessTransform.bb = -30;
brightnessTransform.gb = -30;
brightness.setTransform(brightnessTransform);
This last example adds a new method, MovieClip.doMouseFade(), that brightens and
darkens a clip according to the mouse position:
MovieClip.prototype.doMouseFade = function () {
var brightness = new Color(this);
var brightnessTransform = new Object();
this.onMouseMove = function () {
var brightnessAmount = -255 + (_level0._xmouse / Stage.width) * 510;
brightnessTransform.rb = brightnessAmount;
brightnessTransform.bb = brightnessAmount;
brightnessTransform.gb = brightnessAmount;
brightness.setTransform(brightnessTransform);
updateAfterEvent();
}
}
box.doMouseFade();
Color.getRGB() Method
retrieve the current offset values for Red, Green, and Blue
Flash 5
colorObj.getRGB()
Returns
A number representing the current RGB offsets of colorObj’s target.
Description
The getRGB() method returns a number, ranging from –16777215 to 16777215, that repre-
sents the current color offsets for the Red, Green, and Blue components in a clip; to retrieve
the color percentages, you must use getTransform(). Because color offset values normally
range from 0 to 255, it’s convenient to work with the return value of getRGB( ...