# Attaching dynamically-named bitmaps from library

**URL:** <https://forum.kirupa.com/t/attaching-dynamically-named-bitmaps-from-library/290981>\
**Category:** flash\
**Created:** [June 23, 2009, 9:06am UTC](https://forum.kirupa.com/t/attaching-dynamically-named-bitmaps-from-library/290981 "2009-06-23T09:06:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theMonitor](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@theMonitor](https://forum.kirupa.com/u/theMonitor)\
**Post date:** [June 23, 2009, 9:06am UTC](https://forum.kirupa.com/t/attaching-dynamically-named-bitmaps-from-library/290981/1 "2009-06-23T09:06:16Z")

</div>

I’ve been attempting to attach bitmaps from the library in AS3, and have settled on a piece of code which works:

```php

var myBitmap:Bitmap = new Bitmap(new pic1(0,0));
myMovieClip.addChild(myBitmap);

```

This seems to work fine, as long as the bitmap I’m attaching is the one given the Class ‘pic1’ in the Linkage Properties panel. However, I want to use a Timer event to load a new bitmap after a given interval, which I’m trying to do with the following code:

```php

var bitmapName:String = "pic"+currentPic;
var myBitmap:Bitmap = new Bitmap(new bitmapName(0,0));
myMovieClip.addChild(myBitmap);

```

However, I don’t seem to be having much joy. Could anyone explain what I’m doing wrong?
