Search code examples
iosactionscript-3flashairadobe

Adobe AIR iOS performance using SWC instances


I have an app I am working on that loads data from the server and displays objects on the stage for each record. I have created a library object (with several dynamic text fields) in Flash and exported it as a SWC. When I loop through the data and add a new SWC object for each record, the performance drops completely. There are about 800 records, all with text and background color to set the SWC object color and text fields. Here is some code...

var playerMag:PlayerMag;
for (var i:int=0;i<boardData.Players.length;i++) {
    playerMag = new PlayerMag();
    playerMag.width = 110;
    playerMag.height = 48;
    playerMag.fname.text = boardData.Players[i].fname;
    playerMag.x = boardData.Players[i].X;
    playerMag.y = boardData.Players[i].Y;
    addChild(playerMag as MovieClip);
}

When all the playerMag's are on the stage, dragging and scaling by pinch or finger drag is extremely slow.

Any ideas on how to make it faster that I am missing or don't know? Any help is appreciated.


Solution

  • Generally manipulating textfields in mobile is a really bad idea. Your best bet is to populate them, add them to a container, then draw the container into a bitmap and add the bitmap instead of the textfields.