1

this is a newer version to a question i have asked before but have not received an answer to.

I am developing a mobile AIR app with many animations and tests have shown that using bitmaps and GPU rendering give the best performance across all mobile models. I receive normal vector animations from the app's artists, and have built a system which loops through these animations at runtime and draws the content into bitmapdatas.

my concern is looping through the movieclip's frames. If I have these lines of code:

for (var i:uint=1; i<mc.totalFrames+1; i++) {
  mc.gotoAndStop(i);
  bitmapData.draw(mc);
}

I can't be sure the frame got "constructed" before being drawn, and my tests with an Android tablet prove this right - sometimes frames aren't drawn.

This mc is off the display list obviously (we dont need to render to the screen). So is there a way to make sure the frame has been built before drawing it to a bitmapdata? (and waiting for FRAME_CONSTRUCTED, EXIT_FRAME, etc.. is obviously slow and unneeded)

any ideas? thanx Saar

more info to clarify:

this is a children's book. each page has animations in it. all these animations are vector animations in timelines in FLAs I receive from the devloping artists (not the users). Every page has an FLA which i publish to a swf.

what i actually do is replace vector animations in loaded SWFs with bitmap version of them. At app runtime, upon each new page, i load the swf, go though all the animations in it (looping through the content's children) and each movieclip i rasterize into array of bitmapdatas. My custom "Bitmap Movieclip" places on the displaylist a replcaement bitmap for each movieclip, and on ENTER_FRAME i switch the bitmaps' bitmapdatas from the array. this gives very hight performance

Saariko
  • 502
  • 6
  • 21

2 Answers2

0

I'd suggest use a splash screen, and place your MC to be converted to the bitmap to the stage first, then draw to your bitmapData. Several issues had me force to put a DisplayObject being drawn to the stage before actual drawing once already, so this might be a quick fix for you too.

var splashBD:BitmapData=new BitmapData(stage.stageWidth,stage.stageHeight,false,0xffffff);
var splashBM:Bitmap=new Bitmap(splashBD); // draw a thing as needed here
addChild(splashBM);
addChildAt(MC_to_convert,getChildIndex(splashBM)); 
// then advance it by frames and draw.
Vesper
  • 18,599
  • 6
  • 39
  • 61
0

sorry MY BAD

waiting for FRAME_CONSTRUCTED is the answer

Saariko
  • 502
  • 6
  • 21