Copy link to clipboard
Copied
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
addChild(mc
var addAnim:MovieClip = new anim(); // class from a package, to add clip from library
mc
}
// 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
addChild(mc
}
mc[0].play();
Copy link to clipboard
Copied
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
addChild(mc
}
mc[0].play();
Copy link to clipboard
Copied
It works, thanks a lot.
I had same feeling.
Copy link to clipboard
Copied
You're welcome