3 Replies Latest reply on Feb 7, 2008 10:55 AM by Rhysyngsun

    Drag and Drop issues

      I've been working on trying to implement drag and drop in an AIR application. The drag and drop is between Flex components in the same window, so I'm pretty sure this is a Flex specific issue.

      What is happening is I am dragging and dropping between a datagrid and a canvas. The canvas is embeded in a custom component that is dynamically added to the application when a particular option on a ComboBox is selected. In the custom component, I add handlers for the dragEnter and dragDrop events. The control is responsive to the drop and the dragDrop event fires.

      However, when I execute the following code in my dragDrop handler:

      var data:Array = event.dragSource.dataForFormat( "items" ) as Array;

      asset = data[0] as AssetVO;

      asset is a member variable of the canvas and is of AssetVO type. I have confirmed in the debugger that data[0] indeed holds a non-null object with members that match AssetVO, so the casting should work fine. However, the asset member still remains null.

      I also tried a member-by-member copy and got an error indicating I could not access members of a null object (meaning data[0] cast to an AssetVO).

      BTW, AssetVO is just a plain AS3 bindable class with 4 public members and a contructor. I have done similar casting code with AssetVO elsewhere in the application, so drag and drop seems to be my only issue.

      Anyone know of any solutions?