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 <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED],