Re: [flexcoders] Re: TabNavigator creationPolicy

2009-05-07 Thread Richard Rodseth
Hi Amy,

I solved my own problem (eliminating the use of AddChild) and moved on a
long time ago. I shared my results for the benefit of others, and got a
response from you which I found snide. In case you wish to expand your
knowledge, here's the documentation for AddChild, which as far as I know is
only for use within states.

http://livedocs.adobe.com/flex/3/langref/mx/states/AddChild.html

HTH

On Thu, May 7, 2009 at 11:25 AM, Amy  wrote:

>
>
> --- In flexcoders@yahoogroups.com , Richard
> Rodseth  wrote:
> >
> > Hmm. This seems a little wrong-side-of-the-bed.
> >
> > Actually, when you do:
> >
> > 
> > 
> > 
> > 
> >
> > View1 and View2 are instantiated (obviously necessary to get the labels),
> > but the *children* of the inactive tabs are not, and as a result the
> > creationComplete events of the inactive tabs are not fired. Makes perfect
> > sense if you understand creationComplete to mean "me and all my
> children".
> >
> > On the other hand, if the above MXML is placed in an AddChild of a state,
> > View1 and View2 are both *fully* instantiated, and their creationComplete
> > events fired. This has implications if you are triggering service calls
> on
> > creationComplete.
> >
> > This is hardly equivalent to what you wrote. Try it if you don't believe
> me.
>
> Since you didn't post code, it didn't click with me that you were using
> states. I don't usually use states with Flex, when I use it, which has't
> been for a few weeks.
>
> Nevertheless, I suspect that if you look at the AddChild code, you'll find
> that it works more like what you'd expect in AS vs. MXML.
>
> HTH;
>
> Amy
>
>  
>


[flexcoders] Re: TabNavigator creationPolicy

2009-05-07 Thread Amy
--- In flexcoders@yahoogroups.com, Richard Rodseth  wrote:
>
> Hmm. This seems a little wrong-side-of-the-bed.
> 
> Actually, when you do:
> 
> 
>
>
> 
> 
> View1 and View2 are instantiated (obviously necessary to get the labels),
> but the *children* of the inactive tabs are not, and as a result the
> creationComplete events of the inactive tabs are not fired. Makes perfect
> sense if you understand creationComplete to mean "me and all my children".
> 
> On the other hand, if the above MXML is placed in an AddChild of a state,
> View1 and View2 are both *fully* instantiated, and their creationComplete
> events fired. This has implications if you are triggering service calls on
> creationComplete.
> 
> This is hardly equivalent to what you wrote. Try it if you don't believe me.

Since you didn't post code, it didn't click with me that you were using states. 
 I don't usually use states with Flex, when I use it, which has't been for a 
few weeks.

Nevertheless, I suspect that if you look at the AddChild code, you'll find that 
it works more like what you'd expect in AS vs. MXML.

HTH;

Amy



Re: [flexcoders] Re: TabNavigator creationPolicy

2009-05-06 Thread Richard Rodseth
Hmm. This seems a little wrong-side-of-the-bed.

Actually, when you do:


   
   


View1 and View2 are instantiated (obviously necessary to get the labels),
but the *children* of the inactive tabs are not, and as a result the
creationComplete events of the inactive tabs are not fired. Makes perfect
sense if you understand creationComplete to mean "me and all my children".

On the other hand, if the above MXML is placed in an AddChild of a state,
View1 and View2 are both *fully* instantiated, and their creationComplete
events fired. This has implications if you are triggering service calls on
creationComplete.

This is hardly equivalent to what you wrote. Try it if you don't believe me.

On Wed, May 6, 2009 at 3:39 PM, Amy  wrote:

>
>
> --- In flexcoders@yahoogroups.com , Richard
> Rodseth  wrote:
> >
> > The code that I replaced was adding the entire TabNavigator plus children
> > and grandchildren in an AddChild tag.
> > It appears that deferred instantiation of the grandchildren is
> > non-functional in that case.
>
> Duh.
>
> When you do this:
>
> myThing:Thing = new Thing();
>
> The thing is instantiated right then, in the very moment you, er,
> instantiate it. See?
>
>  
>


[flexcoders] Re: TabNavigator creationPolicy

2009-05-06 Thread Amy
--- In flexcoders@yahoogroups.com, Richard Rodseth  wrote:
>
> The code that I replaced was adding the entire TabNavigator plus children
> and grandchildren in an AddChild tag.
> It appears that deferred instantiation of the grandchildren is
> non-functional in that case.

Duh.

When you do this:

myThing:Thing = new Thing();

The thing is instantiated right then, in the very moment you, er, instantiate 
it.  See?



Re: [flexcoders] Re: TabNavigator creationPolicy

2009-05-05 Thread Richard Rodseth
The code that I replaced was adding the entire TabNavigator plus children
and grandchildren in an AddChild tag.
It appears that deferred instantiation of the grandchildren is
non-functional in that case.

On Tue, May 5, 2009 at 11:14 AM, Amy  wrote:

>
>
> --- In flexcoders@yahoogroups.com , Richard
> Rodseth  wrote:
> >
> > I think I've tracked down what's going on in the actual application (I
> > inherited this portion of the code). The TabNavigator is added in an
> > AddChild tag, and in this case all the children and their children appear
> to
> > get created. Switching to a viewstack as below solved the problem. I
> > actually quite like this state/viewstack idiom.
> >
> > Not sure why the TabNavigator would behave differently in an AddChild,
> > though.
>
> You probably are creating and adding the children of the TabNavigator
> before you use addChild to add _it_. Even if you aren't, how would the
> application know that you have some plan to add children later (that the
> creation process isn' complete).
>
> HTH;
>
> Amy
>
>  
>


[flexcoders] Re: TabNavigator creationPolicy

2009-05-05 Thread Amy
--- In flexcoders@yahoogroups.com, Richard Rodseth  wrote:
>
> I think I've tracked down what's going on in the actual application (I
> inherited this portion of the code). The TabNavigator is added in an
> AddChild tag, and in this case all the children and their children appear to
> get created. Switching to a viewstack as below solved the problem. I
> actually quite like this state/viewstack idiom.
> 
> Not sure why the TabNavigator would behave differently in an AddChild,
> though.

You probably are creating and adding the children of the TabNavigator before 
you use addChild to add _it_.  Even if you aren't, how would the application 
know that you have some plan to add children later (that the creation process 
isn' complete).

HTH;

Amy



Re: [flexcoders] Re: TabNavigator creationPolicy

2009-05-04 Thread Richard Rodseth
Not much, but when you're driving the state from outside (perhaps the app is
bookmarkable, or perhaps the state is loaded from some configuration), then
I think it's nice to separate the notion of state from how it's implemented.

On Mon, May 4, 2009 at 4:59 PM, Tracy Spratt  wrote:

>
>
>  What is the State buying you in this case?  Why not just set
> ViewStack.selectedIndex = 0; //or 1?
>
>
>
> Tracy Spratt,
>
> Lariat Services, development services available
>   --
>
> *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
> Behalf Of *Richard Rodseth
> *Sent:* Monday, May 04, 2009 7:06 PM
> *To:* flexcoders@yahoogroups.com
> *Subject:* Re: [flexcoders] Re: TabNavigator creationPolicy
>
>
>
>
>
>
>  I think I've tracked down what's going on in the actual application (I
> inherited this portion of the code). The TabNavigator is added in an
> AddChild tag, and in this case all the children and their children appear to
> get created. Switching to a viewstack as below solved the problem. I
> actually quite like this state/viewstack idiom.
>
> Not sure why the TabNavigator would behave differently in an AddChild,
> though.
>
> 
> http://www.adobe.com/2006/mxml";
> layout="vertical" xmlns:local="*" currentState="login">
>
> 
> 
>  value="{tabs}"/>
> 
> 
>   value="{login}"/>
> 
> 
>
> 
>
> 
> 
>
> 
>   creationPolicy="auto">
>
> 
>  creationComplete="trace('One  complete')">
> 
>
> 
>
> 
> 
>  creationComplete="trace('Two  complete')">
> 
>
> 
>
> 
> 
>  creationComplete="trace('Three panel complete')"/>
>
> 
>
> 
>
> 
>
>
> 
>
> On Mon, May 4, 2009 at 2:05 PM, Amy  wrote:
>
>
>
> --- In flexcoders@yahoogroups.com , Richard
> Rodseth  wrote:
> >
> > Created a test case below (creation policy is the default null). Most of
> the
> > time, the trace shows "One complete" and when you activate tabs Two and
> > Three you see the trace from those creationComplete events, as expected.
> >
> > But I swear sometimes the Tab Three events fire at startup!
>
> Since none of them have any children, I would expect for their creation to
> be complete immediately--there's nothing else to be done in the creation
> process that hasn't already been done before the labels display in the
> TabNavigator.
>
>
>   
>


RE: [flexcoders] Re: TabNavigator creationPolicy

2009-05-04 Thread Tracy Spratt
What is the State buying you in this case?  Why not just set
ViewStack.selectedIndex = 0; //or 1?

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Richard Rodseth
Sent: Monday, May 04, 2009 7:06 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: TabNavigator creationPolicy

 






I think I've tracked down what's going on in the actual application (I
inherited this portion of the code). The TabNavigator is added in an
AddChild tag, and in this case all the children and their children appear to
get created. Switching to a viewstack as below solved the problem. I
actually quite like this state/viewstack idiom.

Not sure why the TabNavigator would behave differently in an AddChild,
though.


http://www.adobe. <http://www.adobe.com/2006/mxml>
com/2006/mxml" layout="vertical" xmlns:local="*" currentState="login">






 









 



























On Mon, May 4, 2009 at 2:05 PM, Amy mailto:amyblankens...@bellsouth.net> bellsouth.net> wrote:

 

--- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
Richard Rodseth  wrote:
>
> Created a test case below (creation policy is the default null). Most of
the
> time, the trace shows "One complete" and when you activate tabs Two and
> Three you see the trace from those creationComplete events, as expected.
> 
> But I swear sometimes the Tab Three events fire at startup!

Since none of them have any children, I would expect for their creation to
be complete immediately--there's nothing else to be done in the creation
process that hasn't already been done before the labels display in the
TabNavigator.

 





Re: [flexcoders] Re: TabNavigator creationPolicy

2009-05-04 Thread Richard Rodseth
I think I've tracked down what's going on in the actual application (I
inherited this portion of the code). The TabNavigator is added in an
AddChild tag, and in this case all the children and their children appear to
get created. Switching to a viewstack as below solved the problem. I
actually quite like this state/viewstack idiom.

Not sure why the TabNavigator would behave differently in an AddChild,
though.


http://www.adobe.com/2006/mxml"; layout="vertical"
xmlns:local="*" currentState="login">






 









 



























On Mon, May 4, 2009 at 2:05 PM, Amy  wrote:

>
>
> --- In flexcoders@yahoogroups.com , Richard
> Rodseth  wrote:
> >
> > Created a test case below (creation policy is the default null). Most of
> the
> > time, the trace shows "One complete" and when you activate tabs Two and
> > Three you see the trace from those creationComplete events, as expected.
> >
> > But I swear sometimes the Tab Three events fire at startup!
>
> Since none of them have any children, I would expect for their creation to
> be complete immediately--there's nothing else to be done in the creation
> process that hasn't already been done before the labels display in the
> TabNavigator.
>
>  
>


[flexcoders] Re: TabNavigator creationPolicy

2009-05-04 Thread Amy
--- In flexcoders@yahoogroups.com, Richard Rodseth  wrote:
>
> Created a test case below (creation policy is the default null). Most of the
> time, the trace shows "One complete" and when you activate tabs Two and
> Three you see the trace from those creationComplete events, as expected.
> 
> But I swear sometimes the Tab Three events fire at startup!

Since none of them have any children, I would expect for their creation to be 
complete immediately--there's nothing else to be done in the creation process 
that hasn't already been done before the labels display in the TabNavigator.



[flexcoders] Re: TabNavigator creationPolicy

2009-05-04 Thread Richard Rodseth
Created a test case below (creation policy is the default null). Most of the
time, the trace shows "One complete" and when you activate tabs Two and
Three you see the trace from those creationComplete events, as expected.

But I swear sometimes the Tab Three events fire at startup!

The docs for Container do say:
>>>
Navigator containers such as Accordion, TabNavigator, and ViewStack
implement the ContainerCreationPolicy.AUTO policy by creating all their
children immediately, but wait to create the deeper descendants of a child
until it becomes the selected child of the navigator container.
<<<

What I am seeing is not consistent with that either.

Thanks for any advice. I need a reliable way to defer the service calls
associated with each tab.


http://www.adobe.com/2006/mxml"; layout="vertical"
xmlns:local="*">



















ThreePanel.mxml:


http://www.adobe.com/2006/mxml";
creationComplete="onCreationComplete(event)">







On Fri, May 1, 2009 at 4:46 PM, Richard Rodseth  wrote:

> I have a TabNavigator with creationPolicy = "auto".
> The immediate children are intermediate (superfluous) VBoxes containing the
> actual components to be displayed.
> Nevertheless actual component A's creationComplete fires even though it's
> tab is not the active one.
> What's up?
>