# Adding several movieclips to stage from library problem

**URL:** <https://forum.kirupa.com/t/adding-several-movieclips-to-stage-from-library-problem/300738>\
**Category:** Uncategorized\
**Created:** [November 26, 2009, 11:36am UTC](https://forum.kirupa.com/t/adding-several-movieclips-to-stage-from-library-problem/300738 "2009-11-26T11:36:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![welshy](https://avatars.discourse-cdn.com/v4/letter/w/2bfe46/32.png) [@welshy](https://forum.kirupa.com/u/welshy)\
**Post date:** [November 26, 2009, 11:36am UTC](https://forum.kirupa.com/t/adding-several-movieclips-to-stage-from-library-problem/300738/1 "2009-11-26T11:36:29Z")

</div>

I’ve got a movieclip in the library which I want to place on the stage, it’s class is “name1” (I’ll eventually have 25 of these different movieclips in the libarary all named name2, name3 etc”)

If I use this code it works

var n1:MovieClip = new name1();  
this.addChild(n1);  
n1.x = 448.1;  
n1.y = 305.5;

This is fine if I only have 1 movieclip, but I hope to, on a button press add the next in the sequence. So, on a button press I’d remove name1 from the stage and add name2 and so on…

For this I have tried the code

var chosenNameNum = 1;

var n1:MovieClip = new this"name"+ chosenNameNum;  
this.addChild(n1);  
n1.x = 448.1;  
n1.y = 305.5;

but I get the error

TypeError: Error #1007: Instantiation attempted on a non-constructor.  
at acen\_fla::MainTimeline/acen\_fla::frame1()[acen\_fla.MainTimeline::frame1:71]

is what I’m trying to do possible? I’m new to as3 so I’m not sure, any help would be greatly appreciated. Thanks.
