You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Cristian Spiescu <cr...@gmail.com> on 2013/06/08 13:11:56 UTC

ViewNavigator: using view instance instead of view class

Hello,

In some cases, I would like to push to the stack an instance of a view 
that is already constructed.
Is this possible?

Thanks in advance!
Cristian.

Re: ViewNavigator: using view instance instead of view class

Posted by Cristian Spiescu <cr...@gmail.com>.
Thanks. I wanted to investigate what happened in this case. But now I got
the answer. :)
On Jun 10, 2013 9:09 AM, "Cosma Colanicchia" <co...@gmail.com> wrote:

> Note that the destructionPolicy="never" attribute value may be misleading
> (it was for me): it only affects what happens to the view instances when
> another view instance is pushed upon it (i.e. will it be recreated or not
> when the user go back to it).. view instances are always destroyed when the
> they are popped out of the view stack, even with destructionPolicy="never".
>
>
> 2013/6/10 Tianzhen Lin <ta...@usa.net>
>
> > Another approach would be using framework such as Robotlegs where the
> > view/control can be initialized via Mediator.  I have used the
> > container-agnostic approach for quite some time and already forgot about
> > this weird behavior of Views.
> >
> > Tangent
> >
> > -----Original Message-----
> > From: Cristian Spiescu [mailto:cristian.spiescu@gmail.com]
> > Sent: Sunday, June 09, 2013 4:56 PM
> > To: users@flex.apache.org
> > Subject: Re: ViewNavigator: using view instance instead of view class
> >
> > Thanks for the tip!
> >
> > Regards,
> > Cristian
> > On Jun 9, 2013 7:24 PM, "Jonathan Campos" <jo...@gmail.com> wrote:
> >
> > > Most people just create a good method to set the values as soon as the
> > > view is created. Just respond to the viewActivate method. Trust me
> > > that is the easiest way :)
> > >
> > >
> > > On Sat, Jun 8, 2013 at 5:51 PM, Cristian Spiescu <
> > > cristian.spiescu@gmail.com
> > > > wrote:
> > >
> > > > Thanks! This was my impression as well;
> > > >
> > > >  you can change the destruction policy so that it isn't destroyed
> > > >>
> > > > This is true, but I'd need the instance before passing it to the
> > > > view navigator, so that I can populate some data, the "classic way"
> > > > (not by passing the data through the "data" parameter).
> > > >
> > > >  get into the guts of Flex
> > > >>
> > > > Yes; looks doable, by hacking the viewNavigator.navigationStack
> > > > (visibility mx_internal).
> > > >
> > > > Best regards,
> > > > Cristian.
> > > >
> > > >
> > > > On 08.06.2013 21:03, Jonathan Campos wrote:
> > > >
> > > >> you can change the destruction policy so that it isn't destroyed.
> > > >> And
> > > you
> > > >> could get into the guts of Flex and make this change. But I don't
> > > believe
> > > >> it is readily available.
> > > >>
> > > >> J
> > > >>
> > > >>
> > > >> On Sat, Jun 8, 2013 at 6:11 AM, Cristian Spiescu <
> > > >> cristian.spiescu@gmail.com
> > > >>
> > > >>> wrote:
> > > >>> Hello,
> > > >>>
> > > >>> In some cases, I would like to push to the stack an instance of a
> > > >>> view that is already constructed.
> > > >>> Is this possible?
> > > >>>
> > > >>> Thanks in advance!
> > > >>> Cristian.
> > > >>>
> > > >>>
> > > >>
> > > >>
> > > >
> > >
> > >
> > > --
> > > Jonathan Campos
> > >
> >
> >
>

Re: ViewNavigator: using view instance instead of view class

Posted by Cosma Colanicchia <co...@gmail.com>.
Note that the destructionPolicy="never" attribute value may be misleading
(it was for me): it only affects what happens to the view instances when
another view instance is pushed upon it (i.e. will it be recreated or not
when the user go back to it).. view instances are always destroyed when the
they are popped out of the view stack, even with destructionPolicy="never".


2013/6/10 Tianzhen Lin <ta...@usa.net>

> Another approach would be using framework such as Robotlegs where the
> view/control can be initialized via Mediator.  I have used the
> container-agnostic approach for quite some time and already forgot about
> this weird behavior of Views.
>
> Tangent
>
> -----Original Message-----
> From: Cristian Spiescu [mailto:cristian.spiescu@gmail.com]
> Sent: Sunday, June 09, 2013 4:56 PM
> To: users@flex.apache.org
> Subject: Re: ViewNavigator: using view instance instead of view class
>
> Thanks for the tip!
>
> Regards,
> Cristian
> On Jun 9, 2013 7:24 PM, "Jonathan Campos" <jo...@gmail.com> wrote:
>
> > Most people just create a good method to set the values as soon as the
> > view is created. Just respond to the viewActivate method. Trust me
> > that is the easiest way :)
> >
> >
> > On Sat, Jun 8, 2013 at 5:51 PM, Cristian Spiescu <
> > cristian.spiescu@gmail.com
> > > wrote:
> >
> > > Thanks! This was my impression as well;
> > >
> > >  you can change the destruction policy so that it isn't destroyed
> > >>
> > > This is true, but I'd need the instance before passing it to the
> > > view navigator, so that I can populate some data, the "classic way"
> > > (not by passing the data through the "data" parameter).
> > >
> > >  get into the guts of Flex
> > >>
> > > Yes; looks doable, by hacking the viewNavigator.navigationStack
> > > (visibility mx_internal).
> > >
> > > Best regards,
> > > Cristian.
> > >
> > >
> > > On 08.06.2013 21:03, Jonathan Campos wrote:
> > >
> > >> you can change the destruction policy so that it isn't destroyed.
> > >> And
> > you
> > >> could get into the guts of Flex and make this change. But I don't
> > believe
> > >> it is readily available.
> > >>
> > >> J
> > >>
> > >>
> > >> On Sat, Jun 8, 2013 at 6:11 AM, Cristian Spiescu <
> > >> cristian.spiescu@gmail.com
> > >>
> > >>> wrote:
> > >>> Hello,
> > >>>
> > >>> In some cases, I would like to push to the stack an instance of a
> > >>> view that is already constructed.
> > >>> Is this possible?
> > >>>
> > >>> Thanks in advance!
> > >>> Cristian.
> > >>>
> > >>>
> > >>
> > >>
> > >
> >
> >
> > --
> > Jonathan Campos
> >
>
>

RE: ViewNavigator: using view instance instead of view class

Posted by Tianzhen Lin <ta...@usa.net>.
Another approach would be using framework such as Robotlegs where the
view/control can be initialized via Mediator.  I have used the
container-agnostic approach for quite some time and already forgot about
this weird behavior of Views.

Tangent

-----Original Message-----
From: Cristian Spiescu [mailto:cristian.spiescu@gmail.com] 
Sent: Sunday, June 09, 2013 4:56 PM
To: users@flex.apache.org
Subject: Re: ViewNavigator: using view instance instead of view class

Thanks for the tip!

Regards,
Cristian
On Jun 9, 2013 7:24 PM, "Jonathan Campos" <jo...@gmail.com> wrote:

> Most people just create a good method to set the values as soon as the 
> view is created. Just respond to the viewActivate method. Trust me 
> that is the easiest way :)
>
>
> On Sat, Jun 8, 2013 at 5:51 PM, Cristian Spiescu < 
> cristian.spiescu@gmail.com
> > wrote:
>
> > Thanks! This was my impression as well;
> >
> >  you can change the destruction policy so that it isn't destroyed
> >>
> > This is true, but I'd need the instance before passing it to the 
> > view navigator, so that I can populate some data, the "classic way" 
> > (not by passing the data through the "data" parameter).
> >
> >  get into the guts of Flex
> >>
> > Yes; looks doable, by hacking the viewNavigator.navigationStack 
> > (visibility mx_internal).
> >
> > Best regards,
> > Cristian.
> >
> >
> > On 08.06.2013 21:03, Jonathan Campos wrote:
> >
> >> you can change the destruction policy so that it isn't destroyed. 
> >> And
> you
> >> could get into the guts of Flex and make this change. But I don't
> believe
> >> it is readily available.
> >>
> >> J
> >>
> >>
> >> On Sat, Jun 8, 2013 at 6:11 AM, Cristian Spiescu < 
> >> cristian.spiescu@gmail.com
> >>
> >>> wrote:
> >>> Hello,
> >>>
> >>> In some cases, I would like to push to the stack an instance of a 
> >>> view that is already constructed.
> >>> Is this possible?
> >>>
> >>> Thanks in advance!
> >>> Cristian.
> >>>
> >>>
> >>
> >>
> >
>
>
> --
> Jonathan Campos
>


Re: ViewNavigator: using view instance instead of view class

Posted by Cristian Spiescu <cr...@gmail.com>.
Thanks for the tip!

Regards,
Cristian
On Jun 9, 2013 7:24 PM, "Jonathan Campos" <jo...@gmail.com> wrote:

> Most people just create a good method to set the values as soon as the view
> is created. Just respond to the viewActivate method. Trust me that is the
> easiest way :)
>
>
> On Sat, Jun 8, 2013 at 5:51 PM, Cristian Spiescu <
> cristian.spiescu@gmail.com
> > wrote:
>
> > Thanks! This was my impression as well;
> >
> >  you can change the destruction policy so that it isn't destroyed
> >>
> > This is true, but I'd need the instance before passing it to the view
> > navigator, so that I can populate some data, the "classic way" (not by
> > passing the data through the "data" parameter).
> >
> >  get into the guts of Flex
> >>
> > Yes; looks doable, by hacking the viewNavigator.navigationStack
> > (visibility mx_internal).
> >
> > Best regards,
> > Cristian.
> >
> >
> > On 08.06.2013 21:03, Jonathan Campos wrote:
> >
> >> you can change the destruction policy so that it isn't destroyed. And
> you
> >> could get into the guts of Flex and make this change. But I don't
> believe
> >> it is readily available.
> >>
> >> J
> >>
> >>
> >> On Sat, Jun 8, 2013 at 6:11 AM, Cristian Spiescu <
> >> cristian.spiescu@gmail.com
> >>
> >>> wrote:
> >>> Hello,
> >>>
> >>> In some cases, I would like to push to the stack an instance of a view
> >>> that is already constructed.
> >>> Is this possible?
> >>>
> >>> Thanks in advance!
> >>> Cristian.
> >>>
> >>>
> >>
> >>
> >
>
>
> --
> Jonathan Campos
>

Re: ViewNavigator: using view instance instead of view class

Posted by Jonathan Campos <jo...@gmail.com>.
Most people just create a good method to set the values as soon as the view
is created. Just respond to the viewActivate method. Trust me that is the
easiest way :)


On Sat, Jun 8, 2013 at 5:51 PM, Cristian Spiescu <cristian.spiescu@gmail.com
> wrote:

> Thanks! This was my impression as well;
>
>  you can change the destruction policy so that it isn't destroyed
>>
> This is true, but I'd need the instance before passing it to the view
> navigator, so that I can populate some data, the "classic way" (not by
> passing the data through the "data" parameter).
>
>  get into the guts of Flex
>>
> Yes; looks doable, by hacking the viewNavigator.navigationStack
> (visibility mx_internal).
>
> Best regards,
> Cristian.
>
>
> On 08.06.2013 21:03, Jonathan Campos wrote:
>
>> you can change the destruction policy so that it isn't destroyed. And you
>> could get into the guts of Flex and make this change. But I don't believe
>> it is readily available.
>>
>> J
>>
>>
>> On Sat, Jun 8, 2013 at 6:11 AM, Cristian Spiescu <
>> cristian.spiescu@gmail.com
>>
>>> wrote:
>>> Hello,
>>>
>>> In some cases, I would like to push to the stack an instance of a view
>>> that is already constructed.
>>> Is this possible?
>>>
>>> Thanks in advance!
>>> Cristian.
>>>
>>>
>>
>>
>


-- 
Jonathan Campos

Re: ViewNavigator: using view instance instead of view class

Posted by Cristian Spiescu <cr...@gmail.com>.
Thanks! This was my impression as well;
> you can change the destruction policy so that it isn't destroyed
This is true, but I'd need the instance before passing it to the view 
navigator, so that I can populate some data, the "classic way" (not by 
passing the data through the "data" parameter).
> get into the guts of Flex
Yes; looks doable, by hacking the viewNavigator.navigationStack 
(visibility mx_internal).

Best regards,
Cristian.

On 08.06.2013 21:03, Jonathan Campos wrote:
> you can change the destruction policy so that it isn't destroyed. And you
> could get into the guts of Flex and make this change. But I don't believe
> it is readily available.
>
> J
>
>
> On Sat, Jun 8, 2013 at 6:11 AM, Cristian Spiescu <cristian.spiescu@gmail.com
>> wrote:
>> Hello,
>>
>> In some cases, I would like to push to the stack an instance of a view
>> that is already constructed.
>> Is this possible?
>>
>> Thanks in advance!
>> Cristian.
>>
>
>


Re: ViewNavigator: using view instance instead of view class

Posted by Jonathan Campos <jo...@gmail.com>.
you can change the destruction policy so that it isn't destroyed. And you
could get into the guts of Flex and make this change. But I don't believe
it is readily available.

J


On Sat, Jun 8, 2013 at 6:11 AM, Cristian Spiescu <cristian.spiescu@gmail.com
> wrote:

> Hello,
>
> In some cases, I would like to push to the stack an instance of a view
> that is already constructed.
> Is this possible?
>
> Thanks in advance!
> Cristian.
>



-- 
Jonathan Campos