# \[AS3\] Help with containers (add/rem displayObjects)

**URL:** <https://forum.kirupa.com/t/as3-help-with-containers-add-rem-displayobjects/319738>\
**Category:** flash\
**Created:** [March 3, 2011, 12:07am UTC](https://forum.kirupa.com/t/as3-help-with-containers-add-rem-displayobjects/319738 "2011-03-03T00:07:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kpxnamja](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@kpxnamja](https://forum.kirupa.com/u/kpxnamja)\
**Post date:** [March 3, 2011, 12:07am UTC](https://forum.kirupa.com/t/as3-help-with-containers-add-rem-displayobjects/319738/1 "2011-03-03T00:07:46Z")

</div>

Hello,  
I do not understand how to add dynamically set objects into a container.  
To my understanding I have the following code:

```auto

package {
	import ... ;
	public class titlehere extends MovieClip{
		public var ...;

		public function titlehere(){
			var container:MovieClip = new MovieClip();
			container.x = 0;
			container.y = 0;
			addChild(container);
			//generate dynamically a bunch of objects inside container.
			//let's say TunaFish Objects.
			**for(i=0;i < 100; i++){
				container.addChild(tunafish(i));
			}**
		}
	}
}

```

I have read several tutorials that have achieved similar effects by creating an array and pushing the objects to that array. Is that the new way of implementing a container?

If so, how does one clear a container (/array)?

Thanks,  
kpxnamja
