PDA

View Full Version : [AS3] display object container speed problem


thefaster
09-21-2009, 12:06 AM
I know that bitmaps are faster than movieclips. But i don't know if arrays are faster than movieclip containers.

Which one is better?

Option 1.

var container:MovieClip = new MovieClip();
stage.addChild(container);

for (var i:int=0;i<10;i++)
{
var tank:Tank = new Tank(); //Tank is a movieclip in the library.
container.addChild(tank);
}

MovieClip(container.getChildAt(2)).visible = false;

Option 2.

var container:Array = new Array();

for (var i:int=0;i<10;i++)
{
container.push(new Tank()); //Tank is a movieclip in the library.
stage.addChild(container[i]);
}

container[2].visible = false;

I also want to now the pros and cons of each option.

I am asking this is because I made a mini game that runs slow.
And one of the reasons is that all graphics are vectors not bitmaps, but i don't know if i use arrays as containers can speed my game up.