Title: ActionScript 3.0: load an image programmatically
Tags: actionscript-3;adobe
Question: I'm developing an Blackberry Playbock app with ActionScript 3.0. I'm very very new with this.

I have the following project structure (I'm using Adobe Flash Builder "Burrito"):

project
  |
  src
    |
    assets
       |
       images

On image folder I have several PNGs images that I want to load programmatically.

How can I do that?

And

What GUI component I must use to show an image?

Comment: An answer could be found here: http://manewc.com/2008/01/08/as-30-flashdisplayloader-class/

Here is the accepted answer: This example loads one image and uses buttons to change it:

```// create a Loader object to hold things that you will load
var myLoader:Loader = new Loader();

// position the Loader
myLoader.x = 250;
myLoader.y = 0;

// put something into the Loader 
myLoader.load(new URLRequest("tree.jpg"));

// make the Loader visible
addChild(myLoader);

// button listeners
top_btn.addEventListener(MouseEvent.CLICK, loadPhoto);
last_btn.addEventListener(MouseEvent.CLICK, unloadAny);

// button functions
function loadPhoto(e:MouseEvent):void {
    myLoader.load(new URLRequest("sailboat.jpg"));
    addChild(myLoader);
}
// this function empties the Loader object 
function unloadAny(e:MouseEvent):void {
    removeChild(myLoader);
}
```


Here is another answer: if u want to show multiple image using for loop then follow this code: 

```
  var IMAGE_URL:String = new String("image/");
```

```for(var i=1;i<=13;i++){
    addChild(imageLoder(i,i*25));
}

 private function imageLoder(ranvalue:int,cor:int):Loader{
      var ldr:Loader = new Loader();
      ldr.load(new URLRequest(IMAGE_URL+ranvalue+".jpg"));
      var xcord=5;
      var ycord=5;
      ldr.x = cor;
      ldr.y = ycord+20;
      return ldr;
  }
```


Here is another answer: Use the Loader class.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2011:00:03/07/11', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<actionscript-3><adobe>', 'Title': 'ActionScript 3.0: load an image programmatically', 'ViewCount': 5649, 'id': 5222352, 'user_AboutMe': "<p>I'm developing games with Unreal Engine 5 and NFT</p>\n", 'user_AccountId': 26373.0, 'user_DisplayName': 'VansFannel', 'user_Reputation': 43934.0, 'user_Views': 4569.0, 'user_id': 68571.0}}