5 Replies Latest reply on Jan 20, 2010 1:20 AM by Deepa Ganesan

    Mouseover on Tab

    Deepa Ganesan

      Hi,

       

      I have two tabs. Is it possible to view the content of a tab just by moving the mouse over it. Please help.

      Thanks in advance.

        • 1. Re: Mouseover on Tab
          manfred2k3 Level 1

          Hi Deepa

           

          So, the Solution:

           

          Ps: I think you can make it better.. i dont have too much time to make this.. its not so elegant.. comparing labels and so on..
          Try to compare the target with the currentTarget, and cancel when when they are from the same view.

          Thanks!

           

          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application

           

           

          xmlns:mx="http://www.adobe.com/2006/mxml"

          layout="

          absolute">

           

          <mx:Script>

          <![CDATA[

           

          import mx.collections.ArrayCollection;

           

          import mx.core.UIComponentDescriptor;

           

          import mx.controls.Alert;

           

          import mx.utils.ObjectUtil;

           

           

          private function changeView(event:MouseEvent):void

          {

           

          var arrayChild:ArrayCollection=new ArrayCollection(view1.childDescriptors);

           

          for (var i:int=0; i < view1.childDescriptors.length; i++)

          {

           

          if (arrayChild.getItemAt(i).properties.label == event.target.label)

          {

           

          if (view1.selectedIndex != i)

          {

          view1.selectedIndex=i;

          }

          }

          }

          }

          ]]>

           

          </mx:Script>

           

           

          <mx:ViewStack id="view1">

           

          <mx:Canvas label="View1"

          width="

          400"

          id="

          cv1"

          height="

          400"

          backgroundColor="

          white">

           

          <mx:Button horizontalCenter="0"

          verticalCenter="

          0"

          label="

          Button 1"/>

           

          </mx:Canvas>

           

          <mx:Canvas label="View2"

          width="

          400"

          id="

          cv2"

          height="

          400"

          backgroundColor="

          white">

           

          <mx:Button label="Button 2"

          horizontalCenter="

          0"

          verticalCenter="

          0"/>

           

          </mx:Canvas>

           

          </mx:ViewStack>

           

          <mx:TabBar mouseMove="changeView(event)"

          id="

          tab"

          dataProvider="

          {view1}"/>

           

          </mx:Application>

          1 person found this helpful
          • 2. Re: Mouseover on Tab
            Flex harUI Adobe Employee

            You can always programattically set the selectedIndex in a mouseOver event.

            • 3. Re: Mouseover on Tab
              manfred2k3 Level 1

              But How?  Please, post one example.

              Thanks!

              • 4. Re: Mouseover on Tab
                Flex harUI Adobe Employee

                I don't have time for a full example, but it should look something like:

                 

                MouseOver="if (TabBar.getChildAt(0).contains(event.target))

                TabBar.selectedIndex = 0;..."

                • 5. Re: Mouseover on Tab
                  Deepa Ganesan Level 1

                  Thanks to both of you for the update.