Hi.
I'm learning (and trying to work with) as3, and have a problem:
how can i play a movieclip, which is an element of an array?
Code like this:
var mc:Array = new Array();
for(var k=0;k<=4;k++) {
mc[k] = new MovieClip;
addChild(mc[k]);
var addAnim:MovieClip = new anim(); // class from a package, to add clip from library
mc[k].addChild(addAnim); // add clips, which to be played
}
// first frames of child clips appears correctly
mc[0].play(); // nothing happens, no errors...
What do i wrong?
The problem is that you are telling the container (parent) of the animation to play, not the animation. THe mc array holds the 'MovieClip' instances, the MovieClip instances hold the animations.
Try taking the MovieClips out of the picture...
var mc:Array = new Array();
for(var k=0;k<=4;k++) {
mc[k] = new anim(); // class from a package, to add clip from library
addChild(mc[k]); // add clip, which to be played
}
mc[0].play();
North America
Europe, Middle East and Africa
Asia Pacific