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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:53:25+00:00 2026-05-22T16:53:25+00:00

Hey guys! We used to write our UnitTests with FlexUnit and we were just

  • 0

Hey guys!
We used to write our UnitTests with FlexUnit and we were just testing our model. Now we want to test the view too. Before i run my tests i create an instance of my view and my model to test the stuff. When i try to access the view i get a null pointer exception. If i add the view to the displaylist it somehow works – even if i remove it from the list right after adding.

it looks something like this:

var myView: MyView = new myView();
//myView.initialize(); will throw error
Application.application.addChild(view);
Application.application.removeChild(view);
myView.initialize(); // will work

Hope you can give me a hint.

Sims

  • 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-22T16:53:25+00:00Added an answer on May 22, 2026 at 4:53 pm

    Flex UIComponents do not walk through the component lifecycle until after they are added to a container. As such, variables may not be initialized and children may not be created if you never add it to a container.

    More info on the Flex Component LifeCycle. You’ll notice there are 11 steps after the component is added to the container.

    I suspect that adding it, then removing it, could cause other issues but it depends what you’re trying to test.

    To know your exact error, we’d have to see what code is in the initialize method on the view. Most likely it accesses a child that was not created yet.

    MXML components will often masks the lifecycle steps, but a component will still go through them.

    I hope this helps; but since you didn’t ask a question I’m not sure if that was the information you were after.

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

Sidebar

Related Questions

hey guys, i just want to ask if the jquery file tree plugin is
Hey guys got an issue with Cakephp validation.. I want to know why is
Hey guys, I haven't used the rpg pattern before, and had a quick question.
Hey guys, this is my first time actually posting at stackflow but i've used
Hey guys, got a problem with a question. Question : Write a declaration for
Hey guys, I want to make a function loop over all elements that have
Hey guys i want to use an php variable as a part of a
Hey guys in my recent project i have used the valums file uploader for
hey guys, i'm completely new to cURL - i've never used it before. If
Hey guys, I am trying to round to 3 decimal places. I used the

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.