# Less code

**URL:** <https://forum.kirupa.com/t/less-code/281399>\
**Category:** Uncategorized\
**Created:** [February 9, 2009, 12:03am UTC](https://forum.kirupa.com/t/less-code/281399 "2009-02-09T00:03:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alber\_Kidd](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alber\_Kidd](https://forum.kirupa.com/u/Alber_Kidd)\
**Post date:** [February 9, 2009, 12:03am UTC](https://forum.kirupa.com/t/less-code/281399/1 "2009-02-09T00:03:56Z")

</div>

Hi,

I want to make my function with less code, how can I loop through the images and add them without using 4 loaders?

Cheers.

public function addContents (image1, image2, image3, image4) {

```
    var loader:Loader = new Loader();
    loader.load(new URLRequest(image1));
    addChild(loader);

```

var loader2:Loader = new Loader();  
loader.load(new URLRequest(image2));  
addChild(loader2);

var loader3:Loader = new Loader();  
loader.load(new URLRequest(image3));  
addChild(loader3);

var loader4:Loader = new Loader();  
loader.load(new URLRequest(image4));  
addChild(loader4);

```
}
```
