So how do I fire the CollectionChange event from the array so that the menuBar picks up that the collection has changed and to reload the dataProvider?
--- In [email protected], "Dominic Pazula" <[EMAIL PROTECTED]> wrote: > > I believe it is the CollectionChange event. > --- In [email protected], "lampei" <lampei@> wrote: > > > > Cool! That worked. I'm wondering what event is fired for the > > ArrayCollection that made it work...CollectionChange maybe? It'd be > > nice to know "what would work/how to get it to work" for the array > > too, but at least it works for the ArrayCollection. > > > > Thanks. > > > > --- In [email protected], "Fotis Chatzinikos" > > <fotis.chatzinikos@> wrote: > > > > > > Did you try with a bindable ArrayCollection? This usually > dispatches the > > > correct events for UI components to update automatically. > > > > > > [Bindable] > > > var myData:ArrayCollection = new ArrayCollection() ; > > > > > > > > > On Sat, Nov 29, 2008 at 8:19 PM, lampei <lampei@> wrote: > > > > > > > I am trying to update the dataProvider of a MenuBar without > > resetting > > > > the menuBar dataprovider to the original array. > > > > > > > > e.g. > > > > > > > > private var menuData:Array = []; > > > > > > > > private function init():void { > > > > menuData.push( { label: "test1", type: "normal" } ); > > > > menuData.push( { label: "test2", type: "normal" } ); > > > > menuData.push( { label: "test3", type: "normal" } ); > > > > } > > > > > > > > <mx:MenuBar id="mb" dataProvider="{ menuData }" /> > > > > > > > > It works if I put everything in the initial property creation or > > if I do: > > > > > > > > mb.dataProvider = menuData; > > > > > > > > in the init function after I've done all of my array pushes, > but I was > > > > hoping there was a better way of doing things, i.e. firing an > event or > > > > calling a method. > > > > > > > > I have tried mb.validateNow() (in fact, I've tried all validate > > > > methods), but none seem to refresh the menuData dataProvider. > > > > > > > > Anyone have any other ideas, or can tell me what I'm doing > wrong? > > > > > > > > Thanks. > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Fotis Chatzinikos, Ph.D. > > > Founder, > > > Phinnovation > > > Fotis.Chatzinikos@, > > > > > >

