How to draw all frames of a MovieClip in one loop?


#1

Is there a way for me to cycle one by one the frames of a MovieClip to draw (or if possible, CopyPixels them)?

The thing is, SWF animations are really lightweight in build size but perform poorly on the HTML5-Canvas target.

png frame by frame animations are really fast to display, and you can display a lot of them without any lag… but they are heavier in image size.

Since I can load SWF, Can’t I run myself through the MovieClip once, draw each generated frame into a bitmap and (at runtime) generate my spritesheet?

How would I do something like that?

Something like

for (frame in mc.allFramesInsideThisMC)
{
   //I can do the printing myself
   //Something like mybitmap.draw(mc);
   //Or find a way to do copypixels would be awesome.
}

Thank you for your time!


PS: Maybe there is a way to load a lot of SWF movieclips without the performance loss? How would you do something like that? :expressionless:


#2

var i:int = 1;
while(i < mc.totalFrames) {
mc.gotoAndStop(i);
…do somthing…
i++;
}


#3

You can not copypixel from movieclips, you need do next
bitmap.bitmapdata.draw(mc);
Sorry for lowercase