0 Replies Latest reply on Sep 20, 2007 10:35 AM by rkwattsinconnecticut

    Mouseout event in VBox

    rkwattsinconnecticut
      I can't seem to detect a mouse event (MouseOut) on an Accordion menu. I can do it on the TabBar but am not able to do it on the children. I know I am missing something fundamental here. The purpose is to make Accordion (id=locations) property Visible=False when MouseOut occurs on the submenu. Any enlightenment would be appreciated greatly.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:Canvas width="753" height="300" verticalScrollPolicy="off" horizontalScrollPolicy="off" x="0" y="0" >


      <mx:Script>
      <![CDATA[
      import mx.events.ItemClickEvent;
      import mx.controls.TabBar;
      import mx.collections.ArrayCollection;

      [Bindable]
      public var STATE_ARRAY:ArrayCollection = new ArrayCollection([
      {label:"Home", data:"Home"},
      {label:"Locations", data:"Locations"}

      ]);


      public function leavemenu(event:MouseEvent):void
      {
      locations.visible=false;
      }

      public function testIt(event:MouseEvent):void
      {
      if (event.target is Button)
      {textarea2.text=textarea2.text + 1;
      var index:int = bar.getChildIndex(DisplayObject(event.target));
      var tab:Button = Button(bar.getChildAt(index));
      if (tab.label=="Home")
      {
      locations.visible=false;
      }

      if (tab.label=="Locations")
      {
      locations.visible=true;
      locations.x=tab.x;
      locations.y=bar.height+bar.y-2;
      locations.height=locations.numChildren*21;
      }
      }
      if (event.target is VBox)
      {
      textarea2.text=textarea2.text + 2;

      }
      }


      ]]>
      </mx:Script>

      <mx:Canvas x="478" y="93" width="275" height="404" mouseOver="leavemenu(event)">
      </mx:Canvas>
      <mx:TabBar width="600" id="bar" x="0" y="72" mouseOver="testIt(event)"
      height="20">
      <mx:dataProvider>
      {STATE_ARRAY}
      </mx:dataProvider>
      </mx:TabBar>
      <mx:Accordion width="150" id="locations" visible="false"> <!--21 pixels height per line-->
      <mx:VBox label="Bethel, CT" width="100%" height="100%" mouseOver="testIt(event)">
      </mx:VBox>
      <mx:VBox label="Branford, CT" width="100%" height="100%" mouseOver="leavemenu(event)">
      </mx:VBox>
      </mx:Accordion>

      <mx:TextArea x="603" y="74" height="18" width="103" id="searchbox"/>
      <mx:Button x="707" y="74" label="Search" width="46" height="18" fontFamily="Arial"/>
      <mx:TextArea x="327" y="28" id="textarea2"/>
      </mx:Canvas>



      <mx:Image x="0" y="93" source="images/DSC02878.JPG" />
      <mx:TextArea id="textarea1" width="150" x="92" y="546" visible="true"/>

      </mx:Application>