Re: [flexcoders] Nested TabNabvigator/Repeater error

2013-10-22 Thread Alex Harui
I'm not sure what you mean by "the framework".  AFAIK, the framework doesn't 
have any code that automatically switches ViewStack views based on mouse 
activity.

But you could put a breakpoint on the ViewStack code and see why it is changing.

-Alex

From: Tom McNeer mailto:tmcn...@gmail.com>>
Reply-To: "flexcoders@yahoogroups.com" 
mailto:flexcoders@yahoogroups.com>>
Date: Tuesday, October 22, 2013 12:30 PM
To: "flexcoders@yahoogroups.com" 
mailto:flexcoders@yahoogroups.com>>
Subject: Re: [flexcoders] Nested TabNabvigator/Repeater error



Hi Alex,

Thanks very much for the reply.


On Tue, Oct 22, 2013 at 12:56 PM, Alex Harui 
mailto:aha...@adobe.com>> wrote:
In the AS version, I would guess there are relatively few ways to "switch to a 
different screen".

Yeah, I would agree. The reason I used the vague "switch to a different screen" 
is that the resulting action is nothing that is called in the component or even 
its parent.

I'll lay this out as quickly as I can:

There's a view we'll call Cases which has a ViewStack that consists of "Case 
Results" and "Case Details." A search triggered from a parent of the Cases view 
results in a grid in Case Results being populated. A click on a row in the grid 
calls the server for data on an individual Case and switches to the Case 
Details view.

That view contains a TabNavigator for various aspects of the Case, including 
Documents. The nested TabNavigators I'm trying to create are within that 
Documents view.

When I say that a click on any second-level (Document subtype) tab goes "to a 
different screen," what happens is that everything is switched back to the Case 
Results view - taking you back to the first element in the Cases ViewStack. 
There's no action or event defined in any of the child views inside the Case 
Details TabNavigator that would switch the view that way.

That's why I find it confounding.

If you put a breakpoint on code that does that, does it get hit and will the 
stack info show you how it got there?

The code would be in the framework. It would just be the handler for a click on 
the TabBar.

The TabBar children should just be Tabs that dispatch events.  The logic that 
responds to the change event should be the main concern.

Thanks. I understand that. But I'm not writing any code to react to the click 
event. It's just the default action from the framework, which should be to make 
the box corresponding to the Tab the selectedChild of the TabNaviagator.

I have tried walking through my ActionScript, and the oddity I see (which I may 
not really understand) is that even after all the custom components are added 
as children to one of the second-level TabNavigators, the TabNavigator and its 
TabBar show in debugging as having a different number of children.



--
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560




Re: [flexcoders] Nested TabNabvigator/Repeater error

2013-10-22 Thread Tom McNeer
Hi Alex,

Thanks very much for the reply.


On Tue, Oct 22, 2013 at 12:56 PM, Alex Harui  wrote:

> In the AS version, I would guess there are relatively few ways to "switch
> to a different screen".
>

Yeah, I would agree. The reason I used the vague "switch to a different
screen" is that the resulting action is nothing that is called in the
component or even its parent.

I'll lay this out as quickly as I can:

There's a view we'll call Cases which has a ViewStack that consists of
"Case Results" and "Case Details." A search triggered from a parent of the
Cases view results in a grid in Case Results being populated. A click on a
row in the grid calls the server for data on an individual Case and
switches to the Case Details view.

That view contains a TabNavigator for various aspects of the Case,
including Documents. The nested TabNavigators I'm trying to create are
within that Documents view.

When I say that a click on any second-level (Document subtype) tab goes "to
a different screen," what happens is that everything is switched back to
the Case Results view - taking you back to the first element in the Cases
ViewStack. There's no action or event defined in any of the child views
inside the Case Details TabNavigator that would switch the view that way.

That's why I find it confounding.


> If you put a breakpoint on code that does that, does it get hit and will
> the stack info show you how it got there?
>

The code would be in the framework. It would just be the handler for a
click on the TabBar.


> The TabBar children should just be Tabs that dispatch events.  The logic
> that responds to the change event should be the main concern.
>

Thanks. I understand that. But I'm not writing any code to react to the
click event. It's just the default action from the framework, which should
be to make the box corresponding to the Tab the selectedChild of the
TabNaviagator.

I have tried walking through my ActionScript, and the oddity I see (which I
may not really understand) is that even after all the custom components are
added as children to one of the second-level TabNavigators, the
TabNavigator and its TabBar show in debugging as having a different number
of children.



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


Re: [flexcoders] Nested TabNabvigator/Repeater error

2013-10-22 Thread Alex Harui
Probably best to not use repeater.

In the AS version, I would guess there are relatively few ways to "switch to a 
different screen".  If you put a breakpoint on code that does that, does it get 
hit and will the stack info show you how it got there?

You might want to build out a simpler re-construction of this problem in a new 
Flex project so less of your other code can be run accidentally.

The TabBar children should just be Tabs that dispatch events.  The logic that 
responds to the change event should be the main concern.

-Alex

From: Tom McNeer mailto:tmcn...@gmail.com>>
Reply-To: "flexcoders@yahoogroups.com" 
mailto:flexcoders@yahoogroups.com>>
Date: Tuesday, October 22, 2013 6:41 AM
To: "flexcoders@yahoogroups.com" 
mailto:flexcoders@yahoogroups.com>>
Subject: [flexcoders] Nested TabNabvigator/Repeater error



Hi,

I am trying to create nested TabNavigators which are built dynamically from 
server data. The top TabNavigator is static. Its children are created by a 
Repeater. Within each Repeater's child (VBox), another TabNavigator is created, 
and a second Repeater creates the children of the TabNavigator.

This is a revision of a old application, so it's using a 3.6 SDK.

The top level tabs represent types of Documents. The second level of tabs 
represent subtypes. And each time this area is accessed, there will be 
different trees of types/subtype/documents.

The process throws an error intermittently as the elements are created:

RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/getChildAt()
at 
mx.core::Container/getChildAt()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:2377]
at 
mx.controls::ToggleButtonBar/hiliteSelectedNavItem()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\controls\ToggleButtonBar.as:441]
at 
mx.controls::ToggleButtonBar/updateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\controls\ToggleButtonBar.as:364]
at 
mx.core::UIComponent/validateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:6510]
at 
mx.core::Container/validateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:2720]
at 
mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
at 
mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:677]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at 
mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8892]
at 
mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8832]

Since the error reference is to getChildAt(), and before that, to 
hiliteSelectedNavItem, I assume that the error is coming as the framework tries 
to select a tab that does not exist. But I have no clue what to do about it.

Here is the opening MXML:








I have also tried creating the elements in ActionScript, to bypass the Repeater 
action. This results in no errors. Both levels of tabs appear to be created 
properly (by "appear," I mean "visually.") However, when a tab on the second 
level (the subtypes) is clicked, rather than the selected chlid appearing, the 
user is switched to an entirely different screen - completely away from the 
Documents area.

I don't know why the click is taking me away from the screen, but as I walk 
through the debugging, it appears that while the TabNavigator children are 
created correctly, the children of its associated TabBar are not. Here's the 
ActionScript, which is fired by a CollectionChangeEvent listener on the 
ArrayCollection which contains the Document data:

private function buildUI(e:CollectionEvent):void{
clearTabs();
 for(var i:int=0;ihttp://vb.id>='docType' + i;
vb.setStyle('horizontalAlign','center');
vb.label = acCaseDocuments[i].friendlyName as String;
vb.percentWidth=95;
vb.percentHeight=95;
vb.styleName='contentWhite';
var tn:TabNavigator = new TabNavigator();
tn.id='docSubtab' + i;
tn.percentWidth=100;
tn.percentHeight=100;
tn.x=5;
tn.y=5;
tn.setStyle("backgroundAlpha",0);
tn.setStyle('borderThickness',1);
tn.setStyle('paddingTop',0);
for(var j:int=0;jhttp://ddg.id>= 'docSubtype' + j;
ddg.label=arSubtypes[j].friendlyName as 

[flexcoders] Nested TabNabvigator/Repeater error

2013-10-22 Thread Tom McNeer
Hi,

I am trying to create nested TabNavigators which are built dynamically from
server data. The top TabNavigator is static. Its children are created by a
Repeater. Within each Repeater's child (VBox), another TabNavigator is
created, and a second Repeater creates the children of the TabNavigator.

This is a revision of a old application, so it's using a 3.6 SDK.

The top level tabs represent types of Documents. The second level of tabs
represent subtypes. And each time this area is accessed, there will be
different trees of types/subtype/documents.

The process throws an error intermittently as the elements are created:

RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/getChildAt()
at
mx.core::Container/getChildAt()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:2377]
at
mx.controls::ToggleButtonBar/hiliteSelectedNavItem()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\controls\ToggleButtonBar.as:441]
at
mx.controls::ToggleButtonBar/updateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\controls\ToggleButtonBar.as:364]
at
mx.core::UIComponent/validateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:6510]
at
mx.core::Container/validateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\Container.as:2720]
at
mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622]
at
mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:677]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at
mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8892]
at
mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8832]

Since the error reference is to getChildAt(), and before that, to
hiliteSelectedNavItem, I assume that the error is coming as the framework
tries to select a tab that does not exist. But I have no clue what to do
about it.

Here is the opening MXML:








I have also tried creating the elements in ActionScript, to bypass the
Repeater action. This results in no errors. Both levels of tabs appear to
be created properly (by "appear," I mean "visually.") However, when a tab
on the second level (the subtypes) is clicked, rather than the selected
chlid appearing, the user is switched to an entirely different screen -
completely away from the Documents area.

I don't know why the click is taking me away from the screen, but as I walk
through the debugging, it appears that while the TabNavigator children are
created correctly, the children of its associated TabBar are not. Here's
the ActionScript, which is fired by a CollectionChangeEvent listener on the
ArrayCollection which contains the Document data:

private function buildUI(e:CollectionEvent):void{
clearTabs();
 for(var i:int=0;ihttp://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560