Setting the Color of a Movie Clip

by Elis Frugalo.

Share
|
Homepage | Submit your article | Contact | TOS
More articles on databases  

You are here: Categories » Computers and technology » Databases

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
 
Leave a comment or ask a question
Total comments: 0

Databases Disclaimer

  • The e-articles directory is not responsible for any and all copyright infringements by writers and authors. If you suspect the information contained by this page for any copyright infringements, please contact us to investigate the issue
Data Entry and the Various Industries that use this Service - Group of people flooding Excel sheets with alpha and numeric characters... spontaneous sound of pressing keyboards... these are what you will find in data entry service. From giant financial instit (more...)
Different Forms and Variations of Data Entry - Data entry is the procedure of feeding data into spreadsheets and database. It can either be done automatically by a machine that keeps on adding data in the database, or manually by a person who k (more...)
How Data Entry Services Benefit Industries And Why It Is Essential - It is irrelevant whether you have a small business or a global empire - information is an asset in any kind of business. And when it is business, everything comes down to profitability. Today's wor (more...)
What is meant by dirty data - Suppose you have leads or contacts in your CRM system that are missing key information, have bounced email addresses, are just plain incorrect, or if you have dupl (more...)
Managing Monitoring and Troubleshooting SQL Server 2000 - SQL Server Agent Jobs SQL Server Agent is a job scheduling agent that aids in the management of a SQL server. SQL Server Agent can be started when the operating system starts (more...)
Managing and Monitoring SQL Server 2000 Security - Authentication There are two methods of authentication offered SQL Server 2000, Windows authentication and SQL Server authentication. Windows authentication allows the SQL server (more...)
Basic Terms of Structured Query Language (SQL) - The first questions to ask are what is SQL and how do you use it with databases? SQL has three main roles: 1. Creating a database and defining its structure 2. Querying the d (more...)
Extracting and Transforming Data in SQL Server 2000 - SQL Server 2000 has several components that support the import and export of data. Data Transformation Services (DTS) is used to import and export data between like OLE DB (more...)
Introduction to SQL - SQL is an acronym for Structured Query Language and is the standard language for interaction with databases. SQL is both an ISO (International Organization for Standardization) and ANSI (Americ (more...)
What Is a Database - A database is simply an organized collection of information. It allows many different types of data to be stored and retrieved in a highly efficient manner. Information within a database (more...)

 
free content
    Copyright © 2006 - 2012 e-articles.info.
The texts, articles and tutorials in the directory are property of their respective owners and authors.