I am making a mobile application in as3. I'm optimizing. I have a scroll containing 30 objects (buttons). All buttons are the same except its title. This bucle is inside the container scroll:
for(var a:int=0; a<global.get_A.get_B.length; a++)
{
b = new ItemList(global.get_A.get_B[a]);
b.y = this.height;
addChild(b);
b.mouseChildren = false;
}
http://help.adobe.com/en_US/as开发者_Go百科3/mobile/WS4bebcd66a74275c3-576ba64d124318d7189-7ffe.html talking about the reusing objects, but not for interactive objects. Is it possible?
You cannot reuse them if they need to be visible at the same time. Besides, if you're only creating them once (on init) there should be little performance benefit of reusing them. Just make sure you remove them from the display list when they are outside of the visible scroll area, which should improve performance at least a little.
精彩评论