# Is it possible to pull images dynamically from the Library?

**URL:** <https://forum.kirupa.com/t/is-it-possible-to-pull-images-dynamically-from-the-library/279012>\
**Category:** flash\
**Created:** [January 8, 2009, 10:11am UTC](https://forum.kirupa.com/t/is-it-possible-to-pull-images-dynamically-from-the-library/279012 "2009-01-08T10:11:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete\_zahut](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pete\_zahut](https://forum.kirupa.com/u/pete_zahut)\
**Post date:** [January 8, 2009, 10:11am UTC](https://forum.kirupa.com/t/is-it-possible-to-pull-images-dynamically-from-the-library/279012/1 "2009-01-08T10:11:57Z")

</div>

Is it possible to pull images dynamically from the Library - with a **string value containing the name of the class**?

Something like :  
[AS]var bmpd:BitmapData = new [“BitmapFromLibrary”]( 500, 350 );[/AS]

I have a bunch of bitmaps in my library that needs to get pulled out of it as described in an xml file.

I tried something like this, but it doesn’t work.  
TypeError: Error #1007: Instantiation attempted on a non-constructor.

[AS]  
var imglist:XMLList = timeline.chapter[active].imgs.img;  
for each ( var el:XML in imglist )  
{  
trace( el.valueOf() );  
var val:BitmapData = new [el.valueOf()]( 642, 400);  
var img:Bitmap = new Bitmap( val );  
addChild(img);  
}  
[/AS]

Or should I first fill an object/array with a string identifier and the bitmapdata value.

I remember something like this was possible in AS2? [“myclass”]; :h:
