Tried your immediate & default suggestion still gives me view2=NULL. Will try to use view inside Declarations.
Also how can I fix incorrect menu item selected after I set vs.selected=index2? On May 19, 2014 2:04 PM, "Jason Guild" <[email protected]> wrote: > Hi Oleg: > > I don't recall ever encountering #2006. > > There is always an implicit "default" state AFAIK. > You should be able to write itemCreationPolicy="immediate" with > includeIn="default" no problem. > I don't think any additional view states are necessary. > > Perhaps try declaring your various NavigationContent views in an > <fx:Declarations> tag and then use actionscript to add them to the > ViewStack in the creationComplete handler of the parent view which hosts > the ViewStack? > > Also, NavigationContent was, I think, a hack to make Spark components work > inside an mx:ViewStack. Maybe you are hitting some kind of edge case there. > > You could try using a Spark-based ViewStack like this one which does not > need NavigationContent containers: > http://custardbelly.com/downloads/viewstack/srcview/index.html > > HTH, > Jason > > p.s. IMO, Apache Flex really needs an official spark-based ViewStack > implementation. > > On 5/19/2014 9:46 AM, Oleg Konovalov wrote: > >> Jason, I tried that. >> >> It forced me to also add includeIn property (along with >> itemCreationProperty) . >> I had to create a few states (I didn't have any before) , including >> State >> name="Immeriate" and do: includeIn="Immediate", >> then I got error # 2006: The supplied index is out of bounds from Spark >> code... >> How do I resolve that? >> >> >> >> On Mon, May 19, 2014 at 12:37 PM, Jason Guild <[email protected] >> >wrote: >> >> Hi Oleg: >>> >>> Try setting property: >>> itemCreationPolicy="immediate" >>> >>> on the NavigationContent instances in your ViewStack that you need to be >>> available sooner. >>> Jason >>> >>> >>> On 5/19/2014 8:29 AM, Oleg Konovalov wrote: >>> >>> Hi, >>>> >>>> I have a ViewStack with a bunch of NavigationContent's, each of them >>>> having >>>> a View, which contains at least one DataGrid or ADG. >>>> >>>> Trying to implement a transition from one view to another >>>> programmatically, >>>> so user selects a row in one DataGrid, and via right-mouse-click gets a >>>> views selection, >>>> which display related data (in another view). >>>> >>>> It works overall in most cases, >>>> but often I get into situation when that other view is not yet >>>> initialized, >>>> it is still NULL, so user can't call any method related to that view, >>>> like >>>> get a data from related service to populate that DataGrid. >>>> >>>> Suppose I clicked on row in view1, and now trying to show related data >>>> in >>>> view2. >>>> >>>> 1) Is there way to force creation/initialization of that view? >>>> ( I assume, doing view2 = new MyView(params) is too low level >>>> can't do view2.initialize() either since view2=null. ) >>>> >>>> 2) Also even though the second view is displayed (doing >>>> vs.selectedIndex=2), >>>> in the menu on top of that page it still shows previous view selected. >>>> How do I select correct menu item after displaying item2? >>>> >>>> >>>> >>>> >> >
