1 Reply Latest reply on Feb 26, 2008 11:51 PM by ctzn99

    DragManager.showFeedback

    ctzn99 Level 1
      The showFeedback method of the DragManager doesn't seem to do anything when dragging existing elements in an AIR app. It DOES however work when dragging from outside to inside the AIR app.

      In my example below, i've tried to make it very simple, basically, i've got a tree that represents files and folders. You should ONLY be able to drag onto folders, not files. If you drag a file from the desktop onto the files and folders in the tree you get the proper feedback. If you drag the blue canvas onto the tree you get NO feedback at all.

      In fact if you rewrite my entier dragOver event handler and just have DragManager.showFeedBack(DragManager.NONE) it still doesn't work for the canvas drag but it does work for desktop drags.

      Anyone know of a way around this?

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="562" height="241" xmlns:local="*">
      <mx:Script>
      <![CDATA[
      import mx.controls.Tree;
      import mx.core.IUIComponent;
      import mx.events.DragEvent;
      import mx.core.DragSource;
      import mx.managers.DragManager;

      private function moveItem(event:MouseEvent):void
      {
      mx.managers.DragManager.doDrag(IUIComponent(event.currentTarget), new DragSource(), event);
      }

      private function dragEnter(event:DragEvent):void
      {
      DragManager.acceptDragDrop(myTree);
      }

      private function dragOver(event:DragEvent):void
      {
      var dropIndex:int = myTree.calculateDropIndex(event);
      myTree.selectedIndex = dropIndex;

      var selectedItem:XML = XML(myTree.selectedItem);
      if(selectedItem.localName() == "folder")
      DragManager.showFeedback(DragManager.COPY);
      else
      DragManager.showFeedback(DragManager.NONE);
      }

      private function dragDrop(event:DragEvent):void
      {
      // simple example, do nothing
      }
      ]]>
      </mx:Script>

      <mx:Tree id="myTree" x="192" y="24" width="338" height="175" labelField="@label"
      dragEnter="dragEnter(event);"
      dragOver="dragOver(event);"
      dragDrop="dragDrop(event);">
      <mx:XMLList>
      <folder label="Private Files">
      <file label="resume.doc"/>
      <file label="todo list.doc"/>
      <file label="my budget.xls"/>
      </folder>
      <folder label="Public Files">
      <file label="jokes.txt"/>
      </folder>
      </mx:XMLList>
      </mx:Tree>
      <mx:Canvas x="44" y="68" width="101" height="82" mouseMove="moveItem(event);" backgroundColor="#96A7F9" borderStyle="solid" borderThickness="1" borderColor="#000000">
      </mx:Canvas>
      </mx:WindowedApplication>