0 Replies Latest reply on Feb 24, 2008 3:09 AM by tschorakl

    hideDropFeedback, preventDefault does not

    tschorakl
      Hi all,

      i want stop the dragging in handleDrag(...) but does not .. why, what do i wrong?

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      import mx.core.DragSource;
      import mx.managers.DragManager
      import mx.events.DragEvent
      import mx.core.UIComponent
      import mx.collections.XMLListCollection;

      [Bindable]
      private var company:XML =
      <list>
      <department title="Finance" code="200">
      <employee name="John"/>
      <employee name="Sam"/>
      </department>
      </list>;

      [Bindable]
      private var companyData:XMLListCollection = new XMLListCollection(company.department);

      private function treeLabel(item:Object):String{
      var node:XML = XML(item);
      if( node.localName() == "department" )
      return node.@title;
      else
      return node.@name;
      }

      private function handleDrag(event:DragEvent):void{
      event.currentTarget.hideDropFeedback(event);
      event.preventDefault();
      return;
      }

      ]]>
      </mx:Script>
      <mx:Tree id="testTree" width="150"
      dataProvider="{companyData}"
      dragEnabled="true"
      dragEnter="handleDrag(event)"
      labelFunction="treeLabel"/>
      </mx:Application>

      thanks in advance!

      Regards, Tom