0
votes

I created a scene in flash which consists of various different rectangles. I gave each rectangle a name for 'AS Linkage' and added all the rectangles into a movie clip which I called AllBoxes.

I exported this movie clip and imported it into my flash builder project. I can then display the scene in actionscript using:

var allBoxes:AllBoxes = new AllBoxes();
addChild(allBoxes);

which is fine. However, is it possible to then select one of the specific boxes which make up the scene.

For example, could I draw all boxes to the screen and then change the color of one of the boxes. How could I select one of the boxes from the movie clip?

1

1 Answers

0
votes

You need at add a name property to each instance of your rectangles after you place them in the parent MovieClip (AllBoxes). enter image description here

Then you can access them as a property of an AllBoxes instance.

so if you gave one of your rectangles a name of 'rec1' then you'd access it like so:

allBoxes.rec1.transform.colorTransform = new ColorTransform(2);

You can also access all your rectangles using the allBoxes.getChildAt(i) method where 'i' is the layer index of the rectangle you want (between 0 - bottom most - and the allBoxes.numChildren property less 1 which is the foremost rectangle);