Hi,
please help me. I have a viewstack with 4 canvas (pages). The
first is like a index, with images with “click” action that must to
do this:
1. set the viewstack selectedIndex to 1, 2 or 3
2. set the selectedIndex of a datagrid that are in the canvas
2, 3 or 4 of the viewstack.
I’ve tried with:
<mx:Image x=”415″ y=”26″
source=”assets/imgs/inicio/dno_01.jpg”
click=”pages.selectedIndex=2; datagrid1.selectedIndex=2;”/>
and with
:<mx:Script>
<![CDATA[
private function circ_01():void{
pages.selectedIndex=1;
gridProyectos.selectedIndex=5;
}
]]>
</mx:Script>
<mx:Image x=”331″ y=”26″
source=”assets/imgs/inicio/arq_01.jpg” height=”69″ width=”69″
click=”circ_01();”/>
but the first time that I make click only set the viewstack
page/canvas but not the index on the datagrid. BUT the second time
that i make click i set the viewstack page/canvas and the index in
the datagrid…
I really don’t understand.
Thanks a lot!
|||
I’m guessing the problem is that the objects in the canvases
don’t get instanciated before they are being displayed for the
first time.
Thus, you’re probably setting the index of a datagrid that
has not yet been created.
Perhaps you could use the creationComplete event in each
canvas to change the index of the grid?
Or maybe you could hook something up to the childIndexChange
event of the view stack.
hth / Culme|||
Culme is correct, this is the result of the default deferred
instantiation behavior of ViewStack.
As suggested, use an event in the child view, like
creationComplete and show to set the child’s properties.
Tracy
Related posts:
- Please help with ViewStack(Newbie here)
- datagrid selectedIndex bug?
- Can’t refresh DataGrid inside of ViewStack
- Change ViewStack index from component in ViewStack
- XML SelectedIndex
Related posts brought to you by Yet Another Related Posts Plugin.