![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
You can use the methods of the built-in Color class to adjust the color of a movie clip. The setRGB()
method assigns hexadecimal RGB (red, green, blue) values to the movie clip. The following example uses setRGB()
to change an object's color based on user input.
carColor
as the instance name.color chip
, place four instances of the button on the Stage, and name them red
, green
, blue
, and black
. carColor
movie clip, add the following code to the Actions panel:
myColor = new Color(_root.carColor);
carColor
movie clip to blue, add the following code to the Actions panel:
_root.blue.onRelease = function(){ myColor.setRGB(0x0000ff) }
The hexadecimal value 0x0000ff is blue. The following table displays the other colors you'll use and their hexadecimal values:
myColor = new Color(_root.carColor) _root.blue.onRelease = function(){ myColor.setRGB(0x0000ff) } _root.red.onRelease = function(){ myColor.setRGB(0xff0000) } _root.green.onRelease = function(){ myColor.setRGB(0x00ff00) } _root.black.onRelease = function(){ myColor.setRGB(0x000000) }
For more information about the methods of the Color class, see Color class.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |