Maybe you could use the activate event instead of the creation complete
event?

On Tue, Aug 11, 2009 at 2:23 AM, Geoffrey <[email protected]> wrote:

> I'm getting a clearer picture of why I'm seeing state-related issue.
>
> In my setup, state B is a custom component.  This component has event
> listeners for creationComplete and remove.  I noticed that going from state
> A to state B, the creationComplete handler is called.  however, going back
> to state A, the remove event handler is called.  This handler does various
> things to cleanup after itself and one of them is
> 'this.removeAllChildren()'.  When I go back to state B, the UI is blank and
> the creationComplete handler is not called.
>
> This all seems to make sense given the Flex 3 state model, except for the
> calling of the remove handler.  Does removing it from the displayList
> generate the remove event?  If that's the case, then is seems like it's
> intention is to trash that state, allowing for garbage collection.  It
> should then create a new instance of state B when it's accessed the second
> time.
>
> Perhaps we're using the remove event incorrectly.  We use it to clean up.
>  This could involve resetting a  model, removing event handlers, closing
> stray popups, removing all children, etc.  Since this is being called, all
> of the contents of state B are being removed, but are never recreated since
> it doesn't re-instantiate the component in state B.
>
> Any ideas?
>
> Thanks,
>  Geoff
>
> --- In [email protected], "Geoffrey" <gtb...@...> wrote:
> >
> > Great, that's exactly what I wanted to know.  For Flex 3, is there any
> way to free the children for garbage collection, hack or otherwise?
> >
> > --- In [email protected], Gordon Smith <gosmith@> wrote:
> > >
> > > In the Flex 3 states model, if you start in state A, go to state B
> which creates and adds a child, and return to state A, the child is removed
> from the display list but kept around. When you return to state B, it
> doesn't have to be recreated and can just be re-added.
> > >
> > > In the Flex 4 states model, the default behavior is the same, but you
> can use destructon policies to say that the child should not only be removed
> from the display list but also freed for garbage collection.
> > >
> > > Gordon Smith
> > > Adobe Flex SDK Team
> > >
> > > From: [email protected] [mailto:[email protected]]
> On Behalf Of Geoffrey
> > > Sent: Thursday, August 06, 2009 2:43 PM
> > > To: [email protected]
> > > Subject: [flexcoders] Instantiation of State Objects
> > >
> > >
> > >
> > > Are the objects for a state recreated every time a state is entered, or
> if the object was created once, is it reused?
> > >
> > > Basically, I want to know if I swap between states, are the objects
> defined by AddChild new instances every time I enter that state.
> > >
> >
>
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>

Reply via email to