codecraig
|
 |
« on: October 24, 2008, 05:18:30 » |
|
I have a view that extends VBox and contains a TabBar and a custom component. The Mediator for this view (we'll call the view, FooView and FooViewMediator) receives a notification, which causes FooViewMediator to invoke FooView.update( items:ArrayCollection );
The 'update' method in FooView looks like:
<mx:Script> [Bindable] private var dpItems:ArrayCollection;
public function update( items:ArrayCollection ) : void { dpItems = items; var index:int = tabBar.selectedIndex;
// do stuff with the index } </mx:Script>
<mx:TabBar id="tabBar" dataProvider="{dpItems}" />
The error I get is when I try and get the selectedIndex of the tabBar inside the 'update' method because 'tabBar' is still null. I need the index to do something else in the view, however, the other custom component in the view is also still null.
I'm not sure how best to handle this. I mean the FooView is not null which is how I was able to create the FooViewMediator. But now that the mediator is up it gets notifications, but it's child components in the FooView aren't ready.
Suggestions?
|