2 Replies Latest reply on Oct 29, 2006 11:53 PM by sobaka11

    Problem with DragEnter event

      I 've created menu and dragEnter event listener on it. I want the cursor to be green, when it's over menu( during dragging). But the cursor becomes green not over the menu, but at right and down from the menu. Why?

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      // Import the Menu control.
      import mx.controls.Menu;
      import mx.events.MenuEvent;
      import mx.events.DragEvent;
      import mx.managers.DragManager;
      import mx.core.UIComponent;
      import mx.containers.Canvas;
      import mx.controls.DataGrid;
      import mx.core.DragSource;

      private var myMenu:Menu;

      // Create and display the Menu control.
      private function createAndShow():void {
      // The third parameter sets the showRoot property to false.
      // You must set this property in the createMenu method, not later.
      myMenu = Menu.createMenu(null, myMenuData, false);
      myMenu.show(300, 200);
      myMenu.addEventListener(DragEvent.DRAG_ENTER, handleDragEnter,true);
      // DragManager.

      private function handleDragEnter(event:DragEvent):void
      var dropTarget : UIComponent = UIComponent(event.currentTarget);


      <!-- Define the menu data. -->
      <mx:XML format="e4x" id="myMenuData">
      <menuitem label="MenuItem A" >
      <menuitem label="SubMenuItem A-1" enabled="False"/>
      <menuitem label="SubMenuItem A-2"/>
      <menuitem label="MenuItem B" type="check" toggled="true"/>
      <menuitem label="MenuItem C" type="check" toggled="false"/>
      <menuitem type="separator"/>
      <menuitem label="MenuItem D" >
      <menuitem label="SubMenuItem D-1" type="radio" groupName="one"/>
      <menuitem label="SubMenuItem D-2" type="radio" groupName="one"
      <menuitem label="SubMenuItem D-3" type="radio" groupName="one"/>

      <!-- Define a Button control to open the menu -->
      <mx:Button id="myButton" label="Open Menu" dragEnter="createAndShow()" click="createAndShow()"/>

      <mx:DataGrid dragEnabled="true">
      <mx:Object Artist="Pavement" Price="11.99"
      Album="Slanted and Enchanted" />
      <mx:Object Artist="Pavement"
      Album="Brighten the Corners" Price="11.99" />
      <mx:DataGridColumn dataField="Album" />
      <mx:DataGridColumn dataField="Price" />

      -Drag an item from dataGrid
      -Drag over the button -> menu appears
      -Drag over menu -> cursor doesn't change
      -Drag at right and down from the menu -> cursor is green

      Advise me please how to fix this problem