<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to add drag and drop support to datagrids</title>
	<atom:link href="http://www.riacodes.com/flex/how-to-add-drag-and-drop-support-to-datagrids/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.riacodes.com/flex/how-to-add-drag-and-drop-support-to-datagrids/</link>
	<description>Resources, tutorials , tips &#38; tricks for RIA : Flex, Flash, Air, AS3</description>
	<lastBuildDate>Fri, 03 Feb 2012 02:30:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ronnie</title>
		<link>http://www.riacodes.com/flex/how-to-add-drag-and-drop-support-to-datagrids/comment-page-1/#comment-1347</link>
		<dc:creator>Ronnie</dc:creator>
		<pubDate>Mon, 07 Jun 2010 11:07:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=237#comment-1347</guid>
		<description>Hi,
I wanna drag and drop buttons from a list to a canvas. Imagine u have a set of images that u can drag and drop onto a canvas. In place of these images i want buttons. I tried but when i drag and drop, the button disappears from the list. Please let me know how i can just replicate the button in the list onto the canvas when i drag and drop. Please check my code below:

public function dragButton(e:MouseEvent):void
{
				
	 if(e.buttonDown) 
	 {  		   
		var button:Button = e.currentTarget as Button;
		var buttonProxy:Button = new Button();
		buttonProxy.width = button.width;
		buttonProxy.height = button.height; 
		var dragSource:DragSource = new DragSource(); 
		dragSource.addData(button, &#039;button&#039;); 	        	        	        	        	        	        
		DragManager.doDrag(button, dragSource, e);
	} 
			
}
			
public function dragEnter(event:DragEvent): void 
{ 
	var target:Canvas = event.currentTarget as Canvas; 
	if (event.dragSource.hasFormat(&#039;button&#039;)/*  &amp;&amp; target.getChildren().length == 0 */) 
	 { 
		DragManager.acceptDragDrop(target); 
		DragManager.showFeedback(DragManager.COPY); 
	} 
			    
} 		        		   		    			    						
			 
public function dragDrop(event:DragEvent): void 
{ 
	 var target:Canvas = event.currentTarget as Canvas; 
	 var button:Button = event.dragSource.dataForFormat(&#039;button&#039;) as Button; 
	 button.x = event.localX;
	 button.y = event.localY;
	 networkStage.addChild(button); 		    
}</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I wanna drag and drop buttons from a list to a canvas. Imagine u have a set of images that u can drag and drop onto a canvas. In place of these images i want buttons. I tried but when i drag and drop, the button disappears from the list. Please let me know how i can just replicate the button in the list onto the canvas when i drag and drop. Please check my code below:</p>
<p>public function dragButton(e:MouseEvent):void<br />
{</p>
<p>	 if(e.buttonDown)<br />
	 {<br />
		var button:Button = e.currentTarget as Button;<br />
		var buttonProxy:Button = new Button();<br />
		buttonProxy.width = button.width;<br />
		buttonProxy.height = button.height;<br />
		var dragSource:DragSource = new DragSource();<br />
		dragSource.addData(button, &#8216;button&#8217;);<br />
		DragManager.doDrag(button, dragSource, e);<br />
	} </p>
<p>}</p>
<p>public function dragEnter(event:DragEvent): void<br />
{<br />
	var target:Canvas = event.currentTarget as Canvas;<br />
	if (event.dragSource.hasFormat(&#8216;button&#8217;)/*  &amp;&amp; target.getChildren().length == 0 */)<br />
	 {<br />
		DragManager.acceptDragDrop(target);<br />
		DragManager.showFeedback(DragManager.COPY);<br />
	} </p>
<p>} 		        		   		    			    						</p>
<p>public function dragDrop(event:DragEvent): void<br />
{<br />
	 var target:Canvas = event.currentTarget as Canvas;<br />
	 var button:Button = event.dragSource.dataForFormat(&#8216;button&#8217;) as Button;<br />
	 button.x = event.localX;<br />
	 button.y = event.localY;<br />
	 networkStage.addChild(button);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronnie</title>
		<link>http://www.riacodes.com/flex/how-to-add-drag-and-drop-support-to-datagrids/comment-page-1/#comment-1155</link>
		<dc:creator>Ronnie</dc:creator>
		<pubDate>Fri, 07 May 2010 12:01:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=237#comment-1155</guid>
		<description>Hi,
I have been looking to drag and drop buttons from a list onto a canvas. But when i do that, the buttons just vanish from the list. I just want to copy the buttons and move them to the canvas. How do i do it?</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have been looking to drag and drop buttons from a list onto a canvas. But when i do that, the buttons just vanish from the list. I just want to copy the buttons and move them to the canvas. How do i do it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peace4men</title>
		<link>http://www.riacodes.com/flex/how-to-add-drag-and-drop-support-to-datagrids/comment-page-1/#comment-1141</link>
		<dc:creator>peace4men</dc:creator>
		<pubDate>Fri, 30 Apr 2010 18:07:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=237#comment-1141</guid>
		<description>Greaaat</description>
		<content:encoded><![CDATA[<p>Greaaat</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin</title>
		<link>http://www.riacodes.com/flex/how-to-add-drag-and-drop-support-to-datagrids/comment-page-1/#comment-121</link>
		<dc:creator>Benjamin</dc:creator>
		<pubDate>Tue, 21 Jul 2009 12:13:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.riacodes.com/?p=237#comment-121</guid>
		<description>Great tutorial ,

I&#039;ve been wondering how to access the data stored in the destination grid for further processing. Could you please give me a hint.

Regards,
Ben</description>
		<content:encoded><![CDATA[<p>Great tutorial ,</p>
<p>I&#8217;ve been wondering how to access the data stored in the destination grid for further processing. Could you please give me a hint.</p>
<p>Regards,<br />
Ben</p>
]]></content:encoded>
	</item>
</channel>
</rss>

