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 application starts. In my example, I have a tree pointer defined in the markup, and I have AS code that can populate it from a local file or web service. How to connect one with another so that when creating a control code is executed?
In the examples I found in the documentation, everyone uses event handlers, i.e. E. They put 'creationComplete = "myInitFunction (evt)"' in the control's open tag. This would mean that I am writing a small glue function that initializes things.
Now, as I understand it, Markup is really converted to AS classes inside. Can I not just define the class created by the engine and put the startup code in the constructor? Maybe even like extending the Tree class?
EDIT
After a few months Iβm much wiser. After trying to abuse the constructors of extended component classes, I had to find out that Flex does not expect designers to do much - of course, without downloading data from the network.
Explaining the component life cycle in Flex 3 Programming was really helpful. Now my constructors are empty, and I redefine lifecycle methods, such as createChildren
for many things, and use events for something that is related to delay or depends on external factors, especially network materials.
, creationComplete
( HTTPService
), , ResultEvent FaultEvent, ResultEvent , , . , -, .