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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:14:12+00:00 2026-05-11T16:14:12+00:00

I have a class that I instantiate at creation complete: public var catalog :

  • 0

I have a class that I instantiate at creation complete:

public var catalog : AppCollection = new AppCollection (catalogStrip);

CatalogStrip is an HBox.

In this class, I create a VBox and add it as a child to catalogStrip. Here is the constructor for said class:

public function AppCollection (_container : HBox) {
    this.container = _container;
}

And here is the code I’m having trouble with:

public function populate (e : ResultEvent) : void {
    var appImage : Image = new Image ();
    var appText : Text = new Text ();
    var appContainer : VBox = new VBox ();

    appImage.source = "./res/Halo.png";
    appImage.width = 70;
    appImage.height = 70;

    appText.text = "Halo 4";

    appContainer.width = 110;
    appContainer.height = 125;
    appContainer.addChild (appImage);
    appContainer.addChild (appText);

    tbox = appContainer;

    this.container.addChild (appContainer);
}

On the last line, it says that this.container is null. Impossible! I added it in the constructor! Furthermore, I also tried instantiating main.mxml and accessing the container from there. When I try the same code from a script tag in main.mxml, it works, but that kills the whole point of having the class there in the first place. How can I access MXML tags from an external class? I have all my imports and everything…

  • 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-11T16:14:13+00:00Added an answer on May 11, 2026 at 4:14 pm
    public var catalog : AppCollection = new AppCollection (catalogStrip);
    

    Is the in the script portion of the main.mxml? If so, it is the reason you are getting a null object. You need to have a method:

    public var catalog : AppCollection;
    
    private function handleCreationComplete():void
    {
        this.catalog = new AppCollection(catalogStrip);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that looks like this public class SomeClass { public SomeChildClass[]
i have a class A that needs to instantiate a second class B, whose
I my project I have a class that in this class I want to
Background: I have a MainTest class that has many buttons, each of which instantiate
I have a class that inherits from a base class. This base class exposes
Assume I have a class like this: public class Foo { public Bar RequiredProperty
I have a class that I want to instantiate at startup. It does concurrent
I have a class that takes an action in it's constructor. Example: public CustomClass(Action<Path>
I have a class that just has public properties of services that are already
I have a C++ template class that gets instantiated with 3 different type parameters.

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.