Help me to load external jpg files please

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:


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!

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?

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.

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.

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