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

  • Home
  • SEARCH
  • 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 105417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:26:09+00:00 2026-05-11T01:26:09+00:00

Well, not literally, of course, but: I’m new to Flex and I’m trying to

  • 0

Well, not literally, of course, but:

I’m new to Flex and I’m trying to figure out where to put the code that I want to run when my app starts. In my example, I have a tree control defined in the markup, and I have AS code that can populate it from a local file or a webservice. How do I bind the one to the other such that when the control is created, the code is run?

The examples I have found in the documentation all use event handlers, i. e. they put ‘creationComplete=’myInitFunction(evt)” in the control’s opening tag. That would mean I write a little glue function that initializes things.

Now, as I have understood it, the Markup is really converted into AS classes internally. So can I not just define a class that is instantiated by the engine and put my startup code in the constructor? Maybe even like, extending the Tree class?

EDIT:

Months later, I’m a lot wiser. After trying to abuse the constructors of extended component classes, I had to learn that Flex doesn’t expect the constructors to do much – certainly not loading data off the network.

The component life cycle explanation in ‘Programming Flex 3’ was really helpful. Now, my constructors are all empty, and I’m overriding the life cycle methods, such as createChildren for a lot of things, and use events for anything that involves latency or depends on externalities, especially network stuff.

For example, I use creationComplete to initiate an asynchronous network request (using HTTPService), when that returns there are ResultEvent and FaultEvent handlers, the ResultEvent updates a data model to which I data-bound my controls. This is seemingly very Flex-y and works great.

  • 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. 2026-05-11T01:26:10+00:00Added an answer on May 11, 2026 at 1:26 am

    The creationComplete event (on the Application object) is dispatched when the Application component is finished being created. The applicationComplete event is dispatched once the entire application is complete (layout, etc.) and is visible to the user (loading screen is finished).

    For the situation you mention — where you’re populating a control at startup — I’d suggest using the creationComplete event of the component containing the control you want to populate (the Tree in your case), which sounds like it’d be your Application component. This is generally a good practice as often this code will depend on sibling components of the one you’re populating (e.g., an HTTPService component).

    You’re right that all MXML is transformed in AS3 which is then compiled. There’s a compiler flag that will preserve the AS3 that’s generated (it’ll be read-only, though). You don’t want to mess with that. And due to the (somewhat) complex nature of the UIComponent instantiation sequence (constructor, styling, layout, etc.) it is definitely best practice to populate controls in a creationComplete event (or similar).

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

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer By default, ARGV (aka <> which is used behind-the-scenes by… May 11, 2026 at 1:01 pm
  • added an answer I've used Lua on an ARM OMAP processor. Lua's tight… May 11, 2026 at 1:01 pm
  • added an answer A little poking around found this handy helper class: Disable… May 11, 2026 at 1:01 pm

Related Questions

Well, not literally, of course, but: I'm new to Flex and I'm trying to
Well I know it's not evil just not as pretty in semantics as <strong>
Well I am trying to submit a form by pressing enter but not displaying
Ruby on Rails does not do multithreaded request-responses very well, or at least, ActiveRecord
My company does not follow any well defined process for software development. I want
I'm working on a windowing application for a website of mine. Right now, I
I need to store the summer time (daylight saving time) change-over rules for different
It's a tricky question I was asked the other day... We're working on a
i've been tasked with re-organizing a pure HTML site into a CMS. if all

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.