Hi....am flex beginner,here i need to drop an image into the TileList..Tilelistcontains 3 rows and 3 columns. Once i drop the image into the 1st row 1st box.. I shoudnot drop into the same row same box again..but i should drop into the others..How to do it.. here my problem is my dropped image is not at all visible in the tilelist.. I know The drop target can inspect the drag source to determine whether the data is in a format that the target accepts and, if so, let the user drop the data onto it. If the drop target determines that the data is not in an acceptable format, the drop target can disallow the drop operation.but how to do it...
here is my code.... <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.events.*; import mx.core.DragSource; import mx.managers.DragManager; [Bindable] [Embed(source="assets/tn.jpg")] public var img1:Class; private function doDrag(event:MouseEvent):void { var img:Image = event.currentTarget as Image; var dragImg:Image = new Image(); dragImg.source = myImg.source; dragImg.width = myImg.width; dragImg.height=myImg.height; var dsource:DragSource = new DragSource(); dsource.addData(img, 'img'); DragManager.doDrag(img, dsource, event, dragImg); } private function dragAccept(event:DragEvent):void { var dropTarget:TileList = event.currentTarget as TileList; DragManager.acceptDragDrop(dropTarget); } private function dragDrop(event:DragEvent):void { // var img:Image = event.dragSource.dataForFormat('img') as Image; if(event.dragSource.hasFormat("img")) { var dragImg:Image = event.dragSource.dataForFormat('img') as Image; var dropTileList:TileList = event.currentTarget as TileList; var newImage:Image=new Image(); newImage.source = dragImg.source; newImage.x = dropTileList.mouseX; newImage.y = dropTileList.mouseY; dropTileList.addChild(newImage); /* var dropTileList:TileList = event.currentTarget as TileList; ******** if (event.dragSource.hasFormat("img")) { var dragImg:Image = event.dragSource.dataForFormat('img') as Image; ///var dropCanvas:Canvas = event.currentTarget as Canvas; // Since this is a copy, create a new object to // add to the drop target. var newImage:Image=new Image(); newImage.source = dragImg.source; newImage.x = dropTileList.mouseX; newImage.y = dropTileList.mouseY;********* dropTileList.addChild(newImage);*/ } } ]]> </mx:Script> <mx:ArrayCollection id="arr"> <mx:Array id="myArray"> <mx:Object id="one1" name="one"/> <mx:Object id="two2" name="two"/> <mx:Object id="three3" name="three"/> </mx:Array> </mx:ArrayCollection> <mx:TileList x="182" y="120" id="myTileList" rowCount="3" columnCount="3" alternatingItemColors="[#FFFFFF,#258992]" dataProvider="{arr}" dragEnter="dragAccept(event)" dragDrop="dragDrop(event)" dropEnabled="true"> </mx:TileList> <mx:Image x="221" y="388" id="myImg" width="40" height="40" source="@Embed(source='assets/DSC02979.JPG')" mouseMove="doDrag(event)"/> </mx:Application> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

