Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6097863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:05:30+00:00 2026-05-23T13:05:30+00:00

So here’s a loader that works: public var loaders:Array = new Array(); public var

  • 0

So here’s a loader that works:

public var loaders:Array = new Array();
public var loaderClip:Array = new Array();
    function loadPersonmenu() {

        var person:Array = new Array();
        var url:Array = new Array();
        var cityUrl:Array = new Array();

        for (var i = 0; i < personNumber; i++) {
            loaders.push(new Loader());
            loaders[i].contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
            loaders[i].addEventListener(MouseEvent.MOUSE_OVER, lightUp);
            person.push("person" + i + ".swf");  
            url.push(new URLRequest(person[i]));
            loaders[i].load(url[i]);
            loaders[i].x = ((i + 1) * margin) + (i * videoWidth);
            loaders[i].alpha = .5;
            container.addChild(loaders[i]);
            }
}

Everything is fantastic, super-duper, awesome. But when I add some lines to treat the loader content as a MovieClip (so I can apply the stop() function to it), the compiler explodes into an error-fiesta. All my pretty external SWFs vanish. The new lines are at the bottom with comments appended:

public var loaders:Array = new Array();
public var loaders:Array = new Array();
    function loadPersonmenu() {

        var person:Array = new Array();
        var url:Array = new Array();
        var cityUrl:Array = new Array();


        for (var i = 0; i < personNumber; i++) {
            loaders.push(new Loader());
            loaders[i].contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
            loaders[i].addEventListener(MouseEvent.MOUSE_OVER, lightUp);
            person.push("person" + i + ".swf");  
            url.push(new URLRequest(person[i]));
            loaders[i].load(url[i]);
            loaders[i].x = ((i + 1) * margin) + (i * videoWidth);
            loaders[i].alpha = .5;
            container.addChild(loaders[i]);
            loaderClip[i] = MovieClip(loaders[i].content); // Here is a new line
            loaderClip[i].stop(); // Here is another new line
        }
}

These are my errors:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
  at Menu/loadPersonmenu()
  at Menu/fileCompleteListener()
  at flash.events::EventDispatcher/dispatchEventFunction()
  at flash.events::EventDispatcher/dispatchEvent()
  at flash.net::URLLoader/onComplete()

The weird thing is, my function fileCompleteListener() doesn’t even reference any of these Loader instances or SWFs, which is why I didn’t include it in my code. This isn’t a problem in the first conde

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:05:30+00:00Added an answer on May 23, 2026 at 1:05 pm

    You don’t seem to be giving the loader chance to load anything, and so loaders[i].content is null.

    Listen for the complete event before trying to access the loader content. Because you are using multiple loaders you should also assign each loader an instance name using i so that you can use one generic complete listener and reference the loader name to assign the content to the correct index of loaderClip.

    //in the loop
    loaders[i].name = i;
    loaders[i].contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
    
    //////////////////////////////////////////////////
    
    //complete handler method
    private function loadCompleteHandler(evt:Event):void
    {
        var index:int = int(Loader(LoaderInfo(evt.target).loader).name);
        loaderClip[index] = LoaderInfo(evt.target).content;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here's a coding problem for those that like this kind of thing. Let's see
Here is the scenario: I'm writing an app that will watch for any changes
Here's a problem I ran into recently. I have attributes strings of the form
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
Here we go again, the old argument still arises... Would we better have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.