# How to Drag&Drop dynamicly added photo? (problem)

**URL:** https://forum.kirupa.com/t/how-to-drag-drop-dynamicly-added-photo-problem/315206
**Category:** flash
**Created:** [October 20, 2010, 8:43am UTC](https://forum.kirupa.com/t/how-to-drag-drop-dynamicly-added-photo-problem/315206 "2010-10-20T08:43:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sempase](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@sempase](https://forum.kirupa.com/u/sempase)
#### Post date: [October 20, 2010, 8:43am UTC](https://forum.kirupa.com/t/how-to-drag-drop-dynamicly-added-photo-problem/315206/1 "2010-10-20T08:43:42Z")

</div>

Hi Everbody,

i’m adding external photo from pc with this code;

```auto
var f:FileReference = new FileReference();
f.browse([new FileFilter("Images", "*.jpg;*.jpeg*.gif;*.png")]);
f.addEventListener(Event.SELECT, onSelect);

function onSelect(e:Event):void {
    f.load();
    f.addEventListener(Event.COMPLETE, onComplete);
}
function onComplete(e:Event):void {
	var l:Loader = new Loader();
	l.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
	l.loadBytes(f.data);
	addChild(l);
}
function loader_complete(e:Event):void {
    var target_mc:Loader = e.currentTarget.loader as Loader;
}

```

then i wantto drag and drop this photo with this code

```auto
target_mc.addEventListener(MouseEvent.MOUSE_DOWN,DragStart);
target_mc.addEventListener(MouseEvent.MOUSE_UP,DragStop);
function DragStart(event:Event){
	trace("Drag Started!");
	event.target.startDrag(false);
}
 
function DragStop(event:Event){
	trace("Drag Stoped!");
	event.target.stopDrag();
}

```

But it doesn’t works. How can i fix this problem.

Thanks;)
