# My atempt in loading external images

**URL:** https://forum.kirupa.com/t/my-atempt-in-loading-external-images/283027
**Category:** flash
**Created:** [March 1, 2009, 7:21pm UTC](https://forum.kirupa.com/t/my-atempt-in-loading-external-images/283027 "2009-03-01T19:21:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Angel\_Ice](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Angel\_Ice](https://forum.kirupa.com/u/Angel_Ice)
#### Post date: [March 1, 2009, 7:21pm UTC](https://forum.kirupa.com/t/my-atempt-in-loading-external-images/283027/1 "2009-03-01T19:21:56Z")

</div>

Hi guys,

I’m new on As and I’m doing some lessons. I’m loading 2 external images and than positioning them one near the other.

Here is how I do this:

```auto
var img1:URLRequest = new URLRequest("img/img1.jpg");
var loaderImg1:Loader = new Loader();

function fileCaricato (event:Event):void
{
    var immagine1_mc:MovieClip = new MovieClip();
    addChild(immagine1_mc);
    immagine1_mc.addChild(loaderImg1);
    immagine1_mc.scaleX = .25;
    immagine1_mc.scaleY = .25;    
    
    
    var img2:URLRequest = new URLRequest("img/img2.jpg");
    var loaderImg2:Loader = new Loader();

    function fileCaricato2 (event:Event):void
    {
        var immagine2_mc:MovieClip = new MovieClip();
        addChild(immagine2_mc);
        immagine2_mc.addChild(loaderImg2);        
        immagine2_mc.x = immagine1_mc.width +10;
    }

    loaderImg2.contentLoaderInfo.addEventListener(Event.COMPLETE, fileCaricato2);
    loaderImg2.load(img2);
    addChild(loaderImg2);
}

loaderImg1.contentLoaderInfo.addEventListener(Event.COMPLETE, fileCaricato);
loaderImg1.load(img1);
addChild(loaderImg1);

```

It works and it’s fine but i think it’s a little bit to tricky to make every time.  
First of all can you say if it’s correct or there is some more smart way to do this?

Thanks,  
Angel
