# AS2: Apply drag and drop to attachmovie

**URL:** <https://forum.kirupa.com/t/as2-apply-drag-and-drop-to-attachmovie/283368>\
**Category:** flash\
**Created:** [March 5, 2009, 11:23am UTC](https://forum.kirupa.com/t/as2-apply-drag-and-drop-to-attachmovie/283368 "2009-03-05T11:23:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilleypants](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lilleypants](https://forum.kirupa.com/u/lilleypants)\
**Post date:** [March 5, 2009, 11:23am UTC](https://forum.kirupa.com/t/as2-apply-drag-and-drop-to-attachmovie/283368/1 "2009-03-05T11:23:22Z")

</div>

I’ve got the following code:

```auto

function reshuffle() {
	
	plank0_mc.removeMovieClip();
	plank1_mc.removeMovieClip();
	plank2_mc.removeMovieClip();
	plank3_mc.removeMovieClip();
	plank4_mc.removeMovieClip();
	plank5_mc.removeMovieClip();
	plank6_mc.removeMovieClip();
	
	temp_array = [];

	for (i=0; i<8; i++) {
		clip = "plank"+i + "_mc";
		trace(clip);
		temp_array.push(clip);
	}
	
	temp_array.sort(function () {
		return random(2) ? true : false;
	});

	for (i=0; i<8; i++) {
		mcName = temp_array*
		X = 100;
		Y = (40*i)+50;
		_root.attachMovie(mcName,mcName,_root.getNextHighestDepth(),{_x:X, _y:Y});
	}
}

```

Which is great and reshuffles my planks but then I try and use each plank as a drag and drop with the following code:

```auto
plank0_mc.onPress = function() {
	startDrag(this);
	this._rotation = 90;

};

```

But it doesn’t make an on press! Is there something you have to do to refer to a movieclip that has been put on stage by attachMovie?
