That's interesting because I am using the same code for both the lists, for
both the lists I am enabling dragmove enabled property true. In short they
all have the same property defined, so technically they should work but
that's my surprise that they work one way and i cannot drop back.
I have no idea Tracy.
Please let me know if you have any.
Also if it helps should should i change my approach of drag and drop because
as far as i know you can do drag and drop multiple ways, either directly
defining source and destination or using all function drag enter , drag exit
and drag complete.
Pls let me know if you have any altenative.
Thanks
Anuj

On Fri, Nov 7, 2008 at 10:20 AM, Tracy Spratt <[EMAIL PROTECTED]> wrote:

>    Why is it failing?
>
> Tracy
>
>
>  ------------------------------
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *anuj sharma
> *Sent:* Thursday, November 06, 2008 8:38 PM
> *To:* flexcoders@yahoogroups.com
> *Subject:* Re: [flexcoders] Casting Problem Dragging from one list and
> Dropping into another
>
>
>
> Alright Guys I fixed this casting problem, I need to put everythig in XML
> instead of Arrray, it is dropping fields from one list to other now, but now
> i came up with another problem which is that I need to move fields from list
> 1 to list 2, However it is allowing me to move from list one to 2nd but not
> from 2nd to first. The way i enable move is with the dragMoveEnabled
> property true. Below is the code for the both the list. Please let me know
> how would i enable move back from the second list to the first one.
> Thanks again for your help.
> Anuj
>
> //First list
>  var _selectedCameras:List=new List();
> _selectedCameras.dragMoveEnabled=true;
> _selectedCameras.dragEnabled=true;
> _selectedCameras.dropEnabled=true;
>
> //Second List
>  var _selectCameras:List=new List();
>  _selectedCameras.dragMoveEnabled=true;
>  _selectedCameras.dragEnabled=true;
>  _selectCameras.dropEnabled=true;
>  _selectCameras.labelField="@id";
>
> On Thu, Nov 6, 2008 at 4:42 PM, anuj181 <[EMAIL PROTECTED]> wrote:
>
> Hi Guys
> I am trying to drag contents of one list and drop it into the second List.
> I am having issues that first list has values from XML List Collection
> and only i need is the 'id' attribute of the XML and I am successful
> in getting XML List in 1st list. I am using HTTP Service. Now my
> problem is that when i am trying to drag and drop the fields from
> first list it puts filed in the second list with [object,object]. I am
> using array to grab values from 1st list. I have attached the code.
> Anyone has any idea where I am messing things. To me it looks like
> casting problems. Please let me know how would I fix this issue as I
> only need the same field from one list to other.
> Thanks a lot for you help guys
> Anuj
> /*My Code*/
> //First List
> [Bindable]
> public var _selectedCameras:List=new List();
> _selectedCameras.dragEnabled=true;
> _selectedCameras.dataProvider=devicesCollection;
> _selectedCameras.labelField="@id";
>
> //Second List
> var _selectCameras:List=new List();
> _selectCameras.dragEnabled=true;
> _selectCameras.dropEnabled=true;
> _selectCameras.dataProvider=new ArrayCollection();
> _selectCameras.labelField="@id"; _selectCameras.dataProvider=new
> ArrayCollection();
>
> _selectCameras.labelField="@id";_selectCameras.addEventListener(DragEvent.DRAG_DROP,onListDragDrop);
>
>
>
> //Result of the From the data base
> private function devicesXMLHandler(event:ResultEvent):void
> {
> devicesList = event.result.device;
> devicesCollection = new XMLListCollection(devicesList);
> }
> <!--Calling deviceXML Handler-->
> <mx:HTTPService id="devicesXML" method="GET" resultFormat="e4x"
> url="http://10.80.3.56:8182/config/devices";
> result="devicesXMLHandler(event)" showBusyCursor="true"/>
>
> //Calling Function for Drop Manager
> private function onListDragDrop(event:DragEvent):void
> { if(event.dragSource.hasFormat("items"))
> { event.preventDefault();
> event.currentTarget.hideDropFeedback(event);
> var dropTarget:List=List(event.currentTarget);
> var itemArray:Array=event.dragSource.dataForFormat("items") as Array;
> var alrt:Alert=Alert.show(itemArray.toString());
>
> //Copy the new Dragged data into a new Object
>
> var tempItem:Object={label:itemArray[0].label,data:itemArray[0].data};
> //Get the drop location in the destination
> if(dropTarget !=null)
> {
> var dropLoc:int=dropTarget.calculateDropIndex(event);
> }
>
> if((tempItem!=null) && (dropTarget!=null))
> {
> //Add the new object to the drop target
> IList(dropTarget.dataProvider).addItemAt(tempItem,dropLoc);
> }
> }
> }
>
>
>
>  
>

Reply via email to