# External image loading & showing; Error #2007

**URL:** <https://forum.kirupa.com/t/external-image-loading-showing-error-2007/290891>\
**Category:** flash\
**Created:** [June 21, 2009, 9:37pm UTC](https://forum.kirupa.com/t/external-image-loading-showing-error-2007/290891 "2009-06-21T21:37:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sentroy](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@sentroy](https://forum.kirupa.com/u/sentroy)\
**Post date:** [June 21, 2009, 9:37pm UTC](https://forum.kirupa.com/t/external-image-loading-showing-error-2007/290891/1 "2009-06-21T21:37:38Z")

</div>

Hey everyone!  
Just joined kirupaForum and I’m in aid of some help here…

I’m currently working on a game and I’m trying to work out a way to load images externally and display them on the screen.

But the problem is it won’t load them correctly and display them, as seen below…

ERROR:

```auto

TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChild()
    at main_fla::MainTimeline/frame2()
    at flash.display::MovieClip/gotoAndStop()
    at main_fla::MainTimeline/loaded()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

```

And my code (first frame):

```auto

stop();
// Loader - Graphics \\
var gfx_load:URLLoader = new URLLoader();
var gfx_req:URLRequest = new URLRequest("gfx/ind.x");
var weapons:Array = new Array(), bodies:Array = new Array(), env:Array = new Array();
gfx_load.load(gfx_req);
gfx_load.addEventListener(Event.COMPLETE, loaded);
var contentLoad = 0;
addEventListener(Event.ENTER_FRAME, main);

function loaded(event:Event):void
{
    var preArr:Array = gfx_load.data.split("*");
    var count = preArr[0].split(";").length;
    var gfxArr:Array = new Array(preArr[0].split(";"), preArr[1].split(";"), preArr[2].split(";"));
    for(var i=0;i<count;i++)
    {
        load_gfx(gfxArr[0]*, gfxArr[1]*, gfxArr[2]*);
        if(i == count-1)
        {
            contentLoad = 1;
            gotoAndStop(2);
        }
    }
}

function load_gfx(model, select, type):void
{
    var iLoad = new Loader();
    var iReq = new URLRequest("gfx/" + select + ".png");
    iLoad.load(iReq);
    iLoad.contentLoaderInfo.addEventListener(Event.COMPLETE, doLoad);

    function doLoad(evt:Event):void
    {
        switch (type)
        {
            case "weapon":
                weapons[model] = new MovieClip();
                weapons[model].addChild(iLoad);
                break;
            case "body":
                bodies[model] = new MovieClip();
                bodies[model].addChild(iLoad);
                break;
            case "env":
                env[model] = new MovieClip();
                env[model].addChild(iLoad);
                break;
        }
    }
}

```

On the second frame i got:

```auto
addChild(weapons['MP5']);

```

I hope someone out there has an answer for the mess :blah:

And if you have any questions about the code, please just ask!
