views:

28

answers:

2

Hi, i'm trying to effect a number of movieclips inside another movieclip, in this case set the alpha to 20%.

But all i get is an error message. (TypeError: Error #1010: A term is undefined and has no properties. at array_fla::MainTimeline/frame1())

Anyone knows why it's not working?

var myClip = new mcClip;
addChild(myClip);

myClip.x = 270;
myClip.y = 175;


for (var i:Number = 1; i < 6; i++) {
 trace([i]);
 myClip.circle[i].alpha = .2;
}

(there are five circles on the stage in the myClip movieclip named circle1, circle2, circle3...)

+1  A: 

Either make that those 5 circleX an array called circle, or use

myClip["circle" + i].alpha = 0.2;
KennyTM
Awsome... thanks.
Haljan
A: 
for (var i:uint = 0; i < this.numChildren; i++)
{
  this.getChildAt(i).alpha = 0.2;
}

OR

Name the circles movieclips as "circle_1", "circle_2" ... "circle_5" and:

for (var i:uint = 1; i <= 5; i++)
{
  this.getChildByName("circle_" + String(i)).alpha = 0.2;
}
Cheapshot