# Load images based on array position

**URL:** https://forum.kirupa.com/t/load-images-based-on-array-position/307873
**Category:** flash
**Created:** [April 12, 2010, 3:41pm UTC](https://forum.kirupa.com/t/load-images-based-on-array-position/307873 "2010-04-12T15:41:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tbAS3](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tbAS3](https://forum.kirupa.com/u/tbAS3)
#### Post date: [April 12, 2010, 3:41pm UTC](https://forum.kirupa.com/t/load-images-based-on-array-position/307873/1 "2010-04-12T15:41:12Z")

</div>

I’ve searched for ages on this and I can’t see how it’s done, so please help!

I’ve got a set of images in my library and each one has been “exported for actionscript” with class names of stim1, stim2…stim12.

Now, I have a bit of actionscript code that creates instances of these classes and will load the stimuli to the stage:

```auto
var BitmapDataLeft:stim1 = new stim1(150,150);
var imageLeft:Bitmap = new Bitmap(BitmapDataLeft);
addChild(imageLeft);

```

What I would really like to do, however, is load an image based on the current status of a variable. So for example I’ve got an array that has all the image names in it, and a counter called “trialCount”. When this is at 6, I’d like to present item 6 (i.e. cueNames[trialCount]).

How do I merge that with my image loading code?

Or, if it makes more sense, is there a way to create an array of images???

many thanks - as you can see this is all new to me.
