• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Play a movieclip as element of an array

New Here ,
May 29, 2012 May 29, 2012

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 = new MovieClip;

     addChild(mc);

    

     var addAnim:MovieClip = new anim();  // class from a package, to add clip from library

     mc.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?

TOPICS
ActionScript

Views

661

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 29, 2012 May 29, 2012

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 = new anim();  // class from a package, to add clip from library

    addChild(mc);                  // add clip, which to be played

}

mc[0].play();

Votes

Translate

Translate
LEGEND ,
May 29, 2012 May 29, 2012

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 = new anim();  // class from a package, to add clip from library

    addChild(mc);                  // add clip, which to be played

}

mc[0].play();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 29, 2012 May 29, 2012

Copy link to clipboard

Copied

It works, thanks a lot.

I had same feeling.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 29, 2012 May 29, 2012

Copy link to clipboard

Copied

LATEST

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines