# Load images from library with bitmapdata

**URL:** <https://forum.kirupa.com/t/load-images-from-library-with-bitmapdata/303449>\
**Category:** flash\
**Created:** [January 20, 2010, 3:49pm UTC](https://forum.kirupa.com/t/load-images-from-library-with-bitmapdata/303449 "2010-01-20T15:49:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theofiel](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@Theofiel](https://forum.kirupa.com/u/Theofiel)\
**Post date:** [January 20, 2010, 3:49pm UTC](https://forum.kirupa.com/t/load-images-from-library-with-bitmapdata/303449/1 "2010-01-20T15:49:00Z")

</div>

Hi all,  
As my as3 skills are not good, I stumbled against this problem, my approach in overall will probably not be the easiest, but here it goes:

In the library of my fla file I have imported 4 pictures, in the properties (class) I gave them the name photo0, photo1, photo2, photo3. With my code on the time line I create dynamically 4 movieclips and now I want to attach photo0 to movieclip 1 and photo 2 to movieclip 2 and sofort…

Is there a way to give the bitmapdata name also a dynamic name, something like:

[COLOR=black]from: var myBitmapDataObject:picture = new picture(0,0);[/COLOR]  
[COLOR=black]to: var myBitmapDataObject:[COLOR=red]picture\*[/COLOR] = new [COLOR=red]picture\*/COLOR;  
[/COLOR]  
[COLOR=black]or am I completely of track here?[/COLOR]

[COLOR=black]thanks[/COLOR]

```auto

var myArray:Array = new Array();
var spacer:Number = 10;
 
function Main() { 
for(var i:Number=0; i<5; i++){
var newContainer:menuContainer = new menuContainer();
newContainer.name = "container" + i;
myArray.push(newContainer);
 
[COLOR=red]var myBitmapDataObject:picture = new picture(0,0);[/COLOR]
[COLOR=red]var myImage:Bitmap = new Bitmap(myBitmapDataObject);[/COLOR]
[COLOR=red]newContainer.addChild(myImage);[/COLOR]
 
newContainer.x = (stage.stageWidth/2) + ((myArray*.width + spacer)* i);
newContainer.y = (stage.stageHeight/2);
this.addChild(newContainer); 
 }
}
Main(); 

```
