The code below is sufficient to reproduce the problem. _includedAlbums is an ArrayCollection, so no .selectedItem property on that. In any case, I am already happily setting the presentedAlbumIndex by other means. It's the TileList selectedIndex that I need to update properly.
--- In [email protected], "Tim Hoff" <timh...@...> wrote: > > > Not sure what to tell you without having a sample application to play > with. But, you could try some brute force techniques, like: > > _includedAlbums.removeItemAt(1); > presentations.currentPresentation.presentedAlbumIndex = > _includedAlbums.getItemIndex(_includedAlbums.selectedItem); > > -TH > > --- In [email protected], "steve horvath" flexcoders@ > wrote: > > > > > > I've been looking at this for hours. Does anyone know why I am seeing > > this behavior? Or at least tell me how I can debug to provide more > > information. > > > > > > --- In [email protected], "steve horvath" flexcoders@ > > wrote: > > > > > > > > > I have a TileList: > > > > > > <mx:Label id="label1" text="{albumsThumbnailList.selectedIndex}" /> > > > <mx:Label id="label2" > > > text="{presentations.currentPresentation.presentedAlbumIndex}" /> > > > <mx:TileList id="albumsThumbnailList" backgroundAlpha="0" > > > useRollOver="false" initialize="mySizeBinding(event);" > > > > > dataProvider="{presentations.currentPresentation.presentedAlbums}" > > > itemRenderer="PresentationAlbumRenderer" > > > > > > > > > selectedIndex="{presentations.currentPresentation.presentedAlbumIndex}" > > > change="albumChangeHandler()" /> > > > > > > public function test():void { > > > _includedAlbums.removeItemAt(1); > > > dispatchEvent(new Event("albumToggledEvent")); > > > presentedAlbumIndex--; > > > } > > > > > > BEFORE test(): > > > label1 == 5 > > > label2 == 5 > > > > > > AFTER test(): > > > label1 == 5 > > > label2 == 4 > > > > > > Problem is, when the 5th index is currently selected and I delete an > > > item earlier in the list (like index 2), the data provider updates > the > > > list. But the selectedIndex doesn't get updated. (See test() > > > function.) I noticed when I comment out the removeItemAt line, the > > > index gets updated just fine. > > > > > > How do I update the data provider and index in the same operation > and > > > get the TileList to bind correctly? Can I perhaps subclass TileList > > and > > > override a function? Some other way? > > > > > > I tried looking into the internals of ListBase, inspecting > > > selectedIndex, and generally browsing around at runtime. I noticed > > that > > > selectedIndex does get set to 4 momentarily. Then it gets set right > > > back to 5 again. I'm guessing it may have to do with the > > > updateDisplayList or something like that. > > > > > >

