After a few hours of Google searching and random code experimentation 
I'm stumped.  The objective is pretty simple.

In Flex 3, I have a PopUpMenuButton with simple data provider, e.g.:

<mx:PopUpMenuButton id='foo'>
    <mx:dataProvider>
        <mx:ArrayCollection>
            <mx:Object label='Raw Text' data='textView'/>
            <mx:Object label='Tabular' data='tableView'/>
        </mx:ArrayCollection>
    </mx:dataProvider>
</mx:PopUpMenuButton>

The data values correspond to members of a view stack, and I have an 
item click handler on the menu button that changes the current view.  
All is well with the world so far.

Here is the hard part.  Other functionality in the app has its own 
reason to change the current view.  I can easily change the view 
programmatically.  What I haven't been able to do for love nor money 
is to change the state of that PopUpMenuButton to keep it in sync 
with the current view.  I can't find any programmatic way to 
dynamically change the selected item or selected index AND 
(deliberate emphasis on AND) have the change reflected visually (i.e. 
the displayed label on the PopUpMenuButton doesn't change).

The closest I've ever gotten is that internally the state of the 
component must have changed, but visibly it doesn't update until I 
click on the arrow part of the button, e.g. something like:

  Menu(foo.popUp).selectedIndex = 2;

Then clicking on the arrow instantly jumps the component display to 
the value that had been set programmatically.

I figure somebody must have bumped into this problem before.  Any 
suggested solutions, other than something really painful like 
dynamically removing the PopUpMenuButton child from its parent, and 
then programmatically re-creating it with slightly different state?

Thanks

Reid


Reply via email to