# Variables to load library items?

**URL:** <https://forum.kirupa.com/t/variables-to-load-library-items/283746>\
**Category:** flash\
**Created:** [March 10, 2009, 5:30pm UTC](https://forum.kirupa.com/t/variables-to-load-library-items/283746 "2009-03-10T17:30:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![panoonan](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@panoonan](https://forum.kirupa.com/u/panoonan)\
**Post date:** [March 10, 2009, 5:30pm UTC](https://forum.kirupa.com/t/variables-to-load-library-items/283746/1 "2009-03-10T17:30:02Z")

</div>

Is there a way to load library items without directly calling their linkage identifier? I am using a variable called person that is taking the click data name (jay, eric, rob) to work as my dynamic variable. Using this method works fine for loading a jpg into a container movieclip (headshot). But I cannot dynamically target a library item without writing an if statement. Is there any way for me to do this?

here is the rough sketch of where I am:

jay.addEventListener(MouseEvent.CLICK, clicked);  
eric.addEventListener(MouseEvent.CLICK, clicked);  
rob.addEventListener(MouseEvent.CLICK, clicked);

function clicked(e:MouseEvent):void {  
var person = e.target.name;

```
 var headLoader = new Loader();
 headLoader.load(new URLRequest("images/"+person+".jpg"));
 headshot.addChild(headLoader);
 //This loads the proper headshot jpg from my images folder and works just fine

var bio = person+"_bio";
//trace(bio) would return "jay_bio" if jay were clicked.
var bioText = new bio(); //Here is my glitch, because bio is not technically in my library.
bios.addChild(bioText);

```

}

Can anyone help me with this or at least totally shut down the thought that this is possible? Thank you.
