# Another make a loaded swf dragable

**URL:** <https://forum.kirupa.com/t/another-make-a-loaded-swf-dragable/165326>\
**Category:** flash\
**Created:** [October 10, 2005, 12:21pm UTC](https://forum.kirupa.com/t/another-make-a-loaded-swf-dragable/165326 "2005-10-10T12:21:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ditti](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@ditti](https://forum.kirupa.com/u/ditti)\
**Post date:** [October 10, 2005, 12:21pm UTC](https://forum.kirupa.com/t/another-make-a-loaded-swf-dragable/165326/1 "2005-10-10T12:21:16Z")

</div>

Hello again!  
I should be able to manage this myself but I fail.  
I got following code from scotty, and it functions if I have the code in the main timeline. But for me it´s better to have it on the button but I get the error:

> Statement must appear within on handler function preLoad(box, clip) {

Can someone please help me with this.  
I have this code on the button:

```auto
   
on (press) {
		var box = _root.createEmptyMovieClip("holder", _root.getNextHighestDepth());
		box._x = 150;
		box._y = 100;
		preLoad(box, "loaded.swf");
};
function preLoad(box, clip) {
		box.loadMovie(clip);
		var temp = this.createEmptyMovieClip("temp", this.getNextHighestDepth());
		temp.onEnterFrame = function() {
				if (box.getBytesLoaded() == box.getBytesTotal() && box.getBytesTotal()>4) {
						box.drag.onPress = function() {
								this._parent.startDrag();
						};
						box.drag.onRelease = function() {
								stopDrag();
						};
						delete this.onEnterFrame;
				}
		};
}

```
