Some terminology: Classes aren't calling classes. Classes don't call anything... methods inside classes call other methods.
In your MXML, an instance of MainClass is creating instances of subclass1 and subclass2 and -- because they are Sprites, which can have parent/child relationships -- making them its children. Unless you are messing around with the creationPolicy property, or one of your components is a "navigator" (like a ViewStack, Accordion, or TabNavigator that creates children as needed), all the children and granchildren get created when the app is created. Gordon Smith Adobe Flex SDK Team ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Sent: Friday, July 25, 2008 2:59 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] mxml components Ok, I'm trying to get a firm grasp on AS3 components/classes. I'm trying to figure out how to structure code so I can optimize code re-use. What is the life of a component/class in a flex application? In other words... If I have a main.mxml that calls another class like logins.mxml, is that class in existence only while it's called? Once the event hits to call it back is the class still alive? It looks like it kills it from memory but I'm not 100% sure. Take the following examples... MainClass.mxml | |--------subclass1.mxml | |--------subclass2.mxml | |----subclass2a.mxml If MailClass.mxml calls subclass1.mxml, completes and then calls subclass2.mxml which calls subclass2a.mxml, what are the lives of these classes? Also, do I need to be worrying about cleanup or is that handled automatically? I hope I'm explaining this well....