6 Replies Latest reply on Oct 1, 2010 8:10 AM by lathoudero

    Catching Buttonbar button label or index with MouseOver?

    lathoudero

      I've learned that when something simple becomes complex, I'm doing it wrong. So hopefully someone can point me to the rigth direction:

       

      I have a simple buttonbar populated with a viewstack. Works perfectly.

      But now I want to trigger a function with MouseOver, but I can't catch the buttonlabel OR the button index of the button I'm overing over!

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                        xmlns:s="library://ns.adobe.com/flex/spark"
                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
           <s:layout>
                <s:VerticalLayout/>
           </s:layout>

           <fx:Script>
                <![CDATA[
                     protected function buttonbar1_mouseOverHandler(event:MouseEvent):void
                     {

                                      // Get button label of index so a more complex function can be triggered.
                          trace("Buttonlabel is:"+???????);
                     }
                ]]>
           </fx:Script>

           <fx:Declarations>
                <!-- Place non-visual elements (e.g., services, value objects) here -->
           </fx:Declarations>
           <mx:ViewStack x="169" y="104" id="viewstack1" width="477" height="200">
                <s:NavigatorContent label="View 1" width="100%" height="100%">
                     <s:TextArea left="0" right="0" top="0" bottom="0" text="This is view 1"/>
                </s:NavigatorContent>
                <s:NavigatorContent label="View 2" width="100%" height="100%">
                     <s:TextArea left="0" right="0" top="0" bottom="0" text="This is view 2"/>
                </s:NavigatorContent>
                <s:NavigatorContent label="View 3" width="100%" height="100%">
                     <s:TextArea left="0" right="0" top="0" bottom="0" text="This is view 3"/>
                </s:NavigatorContent>
           </mx:ViewStack>
           <s:ButtonBar dataProvider="{viewstack1}" mouseOver="buttonbar1_mouseOverHandler(event)"/>
      </s:Application>