it depends on references, not whether you use or not.
so for example, if the code is like this:
MainClass.mxml
<foo:MainClass>
<foo:SubClass id="bl"/>
</foo:MainClass>
SubClass.mxml
<foo:SubClass>
<foo:SubClass2a id='bla'/>
</foo:SubClass>
they will live forever. But if you load them dynamically, it depends on
where you keep the reference.
If the reference is lost, it 'may' get removed by garbage collector.
(can never be sure because by the nature you cannot control garbage
collector).
So it depends what you mean by call (calling a function or creating) and
also the creation policy of the container class.
One more thing to pay attention on memory manager is be careful with the
event listener. For example
When you write:
A.addEventListener("fooEvent",B.onFooEvent);
a reference from A to B is created, so there is nothing to keep A in the
memory.
If you pay attention on creation policy and addEventListener, you'll be
fine.
yigit
Scott wrote:
>
> 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….
>
>
------------------------------------
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/