# \[opinion needed\] best way to create/render multiple movieclips?

**URL:** <https://forum.kirupa.com/t/opinion-needed-best-way-to-create-render-multiple-movieclips/305004>\
**Category:** programming\
**Created:** [February 17, 2010, 10:10pm UTC](https://forum.kirupa.com/t/opinion-needed-best-way-to-create-render-multiple-movieclips/305004 "2010-02-17T22:10:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ligaa](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@ligaa](https://forum.kirupa.com/u/ligaa)\
**Post date:** [February 17, 2010, 10:10pm UTC](https://forum.kirupa.com/t/opinion-needed-best-way-to-create-render-multiple-movieclips/305004/1 "2010-02-17T22:10:26Z")

</div>

Hey all 🙂

I’m starting work on a new game that has a lot of shapes dynamically generated on the stage. They’re all the same shape, just different sizes. I figured the best way to do this would be an array of movieclips, but then I remembered hearing that things run much better when you clone things out of Bitmap Data. Finding good examples of either solution has been difficult, so I thought I’d try my own.

Here’s what I have so far:

```php
package {
    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    
    public class Magnetron extends MovieClip {
        private var circleSize:Number;
        private var maxSize:Number;
        private var numPullers:Number;
        private var numPushers:Number;
        
        public function Magnetron():void {
            createPullers();
        }
        
        private function createPullers():void {
            numPullers = 10;
            maxSize = 50;
            
            for(var i:Number = 0; i < numPullers; i++){
                circleSize = Math.round(Math.random()*maxSize);
                if(circleSize < 10){
                    circleSize = 10;
                }
                
                var circle:MovieClip = new MovieClip();
                circle.name = "circle"+i;
                circle.graphics.beginFill(0x000000);
                circle.graphics.drawCircle(circleSize,circleSize,circleSize);
                circle.graphics.endFill();
    
                var pullerBMData:BitmapData = new BitmapData(circleSize*2, circleSize*2, true, 0xFFFFFF);
                pullerBMData.draw(circle);
                var puller:Bitmap = new Bitmap(pullerBMData);
                puller.x = Math.round(Math.random()*stage.stageWidth);
                puller.y = Math.round(Math.random()*stage.stageHeight);
                stage.addChild(puller);
            }
        }
        
//=====================================================================
    }
}

```

Well, it works. It puts a bunch of black circles on the stage in random spots, and there’s transparency around the circles. However, here are my concerns:

[LIST=1]  
[_]Is this the right way to copy things out of BitmapData?  
[_]If not, what is the right way? Or, what’s a better way?  
[_]If so, will this actually save on loading/processing?  
[_]How will this method affect hit detection? And what’s the best form of hit detection to use here?  
[\*]Is it still a good idea to load the different shapes into an array to keep track of them? Or is there a better way to keep track?  
[/LIST]  
A hundred questions, and I’ve just started. 😛 I thank anyone who can offer some insight into this!
