flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: Question about Components, Garbage Collection, an CreationComplete
Date Mon, 25 Jul 2016 06:46:22 GMT


On 7/24/16, 8:55 PM, "bilbosax" <waspence41@comcast.net> wrote:

>Surely there is a more straight forward approach that I am
>not familiar with?
>

Well, there is using a bit more ActionScript.  Instead of declaring an
MXML component in our MXML, instantiate it in ActionScript.

IOW, instead of:

<s:Application>
  <s:Button click-"currentState='someState' />
  <s:SomeMXMLComponent id="someComp" includeIn="someState" />
</s:Application>

You can do something like this:

<s:Application>
  <s:Button click-"currentState='someState'; someComp = new
SomeMXMLComponent(); addElement(someComp);" />
</s:Application>


Some other code that switches away from someState would call
removeElement(someComp) and someComp = null;

As long as SomeMXMLComp doesn't have any other references to it, it would
go away.

HTH,
-Alex

Mime
View raw message