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 939921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:52:15+00:00 2026-05-15T21:52:15+00:00

I have two classes, call them A and B. They both contain a Loader

  • 0

I have two classes, call them A and B. They both contain a Loader object. In class A I load content into the Loader object.

public class A {
    var loader:Loader;

    public function A():void {
        loader = new Loader();
        this.addChild(loader);
        loader.load(...);
    }
}

public class B() {
    var loader:Loader;

    public function B():void {
        loader = new Loader(); 
        this.addChild(loader);
    }
}

I need to now assign A’s Loader to B’s Loader (after the load is complete).

In some other class I have an instance of A and B. Doing a direct assignment of the loader values doesn’t seem to work (when showing B, A’s loader content is not displayed).

var b:B = new B();
var a:A = new A();

// ... I wait for a's loader to be loaded ...
// ... then ... 
b.loader = a.loader;
addChild(b);
// A's Loader is not shown ...

If I do the following, it works:

b.addChild(a.loader);

But that’s not what I want. I don’t want to manage a bunch of children when I know I only have one child but just want to change its content.

Is there a way to copy/assign a Loader directly? I tried assigning to ‘content’ but that’s read-only. Is there another way I can do this? Basically I have an array of Loader objects that all get loaded with images. I then have a single Loader that’s on the stage and I want to assign to it images (Loaders) from my array.

Thanks.

  • 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-15T21:52:15+00:00Added an answer on May 15, 2026 at 9:52 pm

    I ended up swapping the children to get the same effect. It’s less complicated than I thought it would be.

    So basically in B I did:

    this.setChildIndex(loader,0);
    

    This is to make sure the loader is at index 0. (It can be any fixed index but in my case I needed it to appear at the bottom). It’s not necessary to have a loader in B initially but I just put it there to make sure there’s something fixed at index 0 (so I don’t accidentally remove some other child).

    Then when setting A’s loader to B I’d just swap out the child at index 0.

    b.removeChildAt(0);  
    b.addChildAt(a.loader,0);
    

    It’s not exactly the solution I wanted but it’s working well so far.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two classes (let's call them A and B ), both inheriting from
I have two classes, let's call them parent and child, and both need to
I have two classes and both of them uses some of the other class,
I have two classes that I am testing (let's call them ClassA and ClassB).
I have two classes which both extend from SQL class like this: class SQL
Is it possible in C++ to have two classes, let's call them A and
Okay, so I have two classes, call them A and B--in that order in
There are two classes, let's call them Class A and Class B. Also, in
I have two classes (let's call them Working and ReturnStatement) which I can't modify,
I have two classes: an Object class, and an ObjectManager class. The ObjectManager class

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.