How to copy the background color between movieclips in a component.
I need to copy the background color from one movieclip to another inside a component I'm building.
The component is a Tab component that allows to select one of several movieclips to display in a data entry application. I mean, once deployed in the Stage you can associate each "ear" of the Tab with a different movieclip (and assign a name to that ear too). For example:
tab[1]: name = "ID"; movie = ID_data.
tab[2]: name = "Job"; movie = Job_data.
etc.
When the user clicks on tab[2], for example, I want the background color of this tab to become the same as the background color of the Job_data movieclip.
Here is my current code:
//******************************
import flash.geom.Transform;
import flash.geom.ColorTransform;
class SysnetTab8 extends MovieClip {
private var __pestanas:Array = new Array(); // stores the tabs objects
private var __peliculas:Array = new Array(); // stores the movieclips
function selectTab (numeroTab:Number) {
...
__pestanas[numeroTab].gotoAndStop (2);
__pestanas[numeroTab].pestanaActiva.transform.colorTransform = _root[__peliculas[numeroTab]].transform.colorTransform;
...
}
//******************************
Each tab is an instance of a movieclip that has two frames and several layers. In one layer I have a movieclip with name pestanaActiva spread over the two frames. This movieclip is the one I need to change its color.
__pestanas[numeroTab].pestanaActiva correctly points to that movieclip as revealed by traceing it.
I had to use _root[__peliculas[numeroTab]] because I was unable to store this reference in the __peliculas array (I always got an undefined). So the array stores the names of the movieclips and the implicit eval returns the correct reference.
Despite of this, the transform and transform.colorTransform properties always returns undefined.
This is nasty because when I put this code outside the class it functions perfectly!
Can someone help me? I am making some mistake?
Tnanks in advance.
|