learn more...You want to control the color of a movie clip dynamically (at runtime, rather than during authoring). Create a Color object that targets the desired movie clip, and then use the Color.setRGB( ) method. You can't change the color of a movie clip directly. Instead, you must first create a Color object that targets the movie clip of interest, as follows: my_color = new Color(myMovieClip); You can alternatively specify the movie clip name as a string: my_color = new Color("myMovieClip");
The target movie clip, as specified when creating a Color object, must correspond to the name of a movie clip instance on the Stage, not the name of the Library symbol from which the clip is derived. Therefore, you must set the target clip's instance name using the Property inspector before you can target it using a Color object. A Color object can target a movie clip on any timeline using an absolute or relative reference, such as: my_color = new Color(_root.myMovieClip); my_color = new Color(_parent.myMovieClip); Once you have created a Color object, you can use it to control the color of the targeted movie clip instance. The Color.setRGB( ) method applies a single color value to the movie clip targeted by the Color object (as specified when the Color object was created), filling the entire movie clip shape with a single color. The color value can be of any valid ActionScript numeric format. The following examples both apply a solid blue color to the targeted movie clip: my_color.setRGB(0x0000FF); // Hexadecimal my_color.setRGB(255); // Decimal The following examples both apply a solid lime green color to the targeted movie clip: my_color.setRGB(0xA9FC9C); // Hexadecimal my_color.setRGB(11140252 ); // Decimal |
||||||
Disclaimer
1) E-articles is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us to investigate the problem.
2) E-articles is not responsible for inaccuracies, falsehoods, or any other types of misinformation this article may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here. link to this article |