# Help me to load external jpg files please

**URL:** <https://forum.kirupa.com/t/help-me-to-load-external-jpg-files-please/265282>\
**Category:** Uncategorized\
**Created:** [July 7, 2008, 1:26pm UTC](https://forum.kirupa.com/t/help-me-to-load-external-jpg-files-please/265282 "2008-07-07T13:26:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecptavares](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@ecptavares](https://forum.kirupa.com/u/ecptavares)\
**Post date:** [July 7, 2008, 1:26pm UTC](https://forum.kirupa.com/t/help-me-to-load-external-jpg-files-please/265282/1 "2008-07-07T13:26:14Z")

</div>

Hi!

I am trying to load an external JPG file but I am having some weird problems. I was looking at a tutorial of how to load external files and I’ve done everything correctly but it is not working.

Here is my code:

```auto

var loadBanner : Loader = new Loader();
var url1 : URLRequest = new URLRequest("banner.jpg");

loadBanner.load(url1);
bg.addChild(loadBanner);

loadBanner.contentLoaderInfo.addEventListener(Event.OPEN,onOpenLoader);
loadBanner.contentLoaderInfo.addEventListener(Event.COMPLETE,onCompLoader);

function onOpenLoader(event:Event):void
{
    loading_txt.visible = true;
}

function onCompLoader(event:Event):void
{
    loading_txt.visible = false;
}
  
  stop();

```

bg is a MC that I want to load the jpg into.

and here is the error message I am getting.

> 

1120: Access of undefined property bg.

What am I doing wrong please!

---

<div class="post-metadata">

**Author:** ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)\
**Post date:** [July 7, 2008, 2:18pm UTC](https://forum.kirupa.com/t/help-me-to-load-external-jpg-files-please/265282/2 "2008-07-07T14:18:22Z")

</div>

Error messages are more intuitive than you might think. That message means that wherever you’re trying to access ‘bg’ does not have access to that movieclip/sprite.

Are you doing this in the timeline? Where is the bg object? Stage? Library?

---

<div class="post-metadata">

**Author:** ![ecptavares](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@ecptavares](https://forum.kirupa.com/u/ecptavares)\
**Post date:** [July 7, 2008, 4:17pm UTC](https://forum.kirupa.com/t/help-me-to-load-external-jpg-files-please/265282/3 "2008-07-07T16:17:47Z")

</div>

Hi!

bg is a movie clip that is a square animating from its alpha 0 to 100 and scaling up. At the end of this scale and alpha animation I have a keyframe(in the actions layer) that has that code I´ve posted before.  
The bg movie clip is at the stage.

---

<div class="post-metadata">

**Author:** ![snickelfritz](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@snickelfritz](https://forum.kirupa.com/u/snickelfritz)\
**Post date:** [July 7, 2008, 7:16pm UTC](https://forum.kirupa.com/t/help-me-to-load-external-jpg-files-please/265282/4 "2008-07-07T19:16:42Z")

</div>

Make sure you give the bg movieclip an instance name of “bg”.  
BTW, I highly recommend using TweenLite or TweenMax, instead of the timeline for simple tweens like this.

---

<div class="post-metadata">

**Author:** ![ecptavares](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@ecptavares](https://forum.kirupa.com/u/ecptavares)\
**Post date:** [July 7, 2008, 9:54pm UTC](https://forum.kirupa.com/t/help-me-to-load-external-jpg-files-please/265282/5 "2008-07-07T21:54:32Z")

</div>

Hi!  
I did give it an instance name of bg.  
Where do I find tutorials about this tweeners?
