A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Loader class not firing Event.COMPLETE

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Location
    MA
    Posts
    273

    Loader class not firing Event.COMPLETE

    I'm having a problem that's got me stuck in AS3. I have this seemingly simple code:

    PHP Code:
    var loader:Loader = new Loader();
    loader.addEventListener(Event.COMPLETE, function(event:Event):void{
        
    trace('hi');
    });
    loader.load(new URLRequest('photo.jpg')); 
    The event.complete is never firing. Nothing I do works. If I make it a URLLoader and not a regular Loader it goes through fine and the event is fired, however this is an image I need to add to the stage so I need to use a Loader. But I can't figure out for the life of me why the event.complete isn't firing. I know it's loading because I can add the loader to the stage and the image shows up. Doesn't matter if I do local images or images from a server. What's going on here?

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I don't know what is happening, but you should add a listener for ioerror, and try to catch SecurityErrors to find out.

  3. #3
    Senior Member
    Join Date
    Apr 2003
    Location
    MA
    Posts
    273
    Oh, figured it out. Didn't read the help files closely enough. It's

    loader.contentLoaderInfo.addEventListener()

    not

    loader.addEventListener()

    but thanks, you pointed me in the right direction

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center