# \_root\[myPic\].onPress?

**URL:** <https://forum.kirupa.com/t/-root-mypic-onpress/199111>\
**Category:** flash\
**Created:** [August 31, 2006, 5:17am UTC](https://forum.kirupa.com/t/-root-mypic-onpress/199111 "2006-08-31T05:17:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nineteen](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nineteen/32/2679_2.png) [@Nineteen](https://forum.kirupa.com/u/Nineteen)\
**Post date:** [August 31, 2006, 5:17am UTC](https://forum.kirupa.com/t/-root-mypic-onpress/199111/1 "2006-08-31T05:17:44Z")

</div>

My Code:

```auto

//Pic Number
var picNumber:Number = 1;
preload.onLoadComplete = function(targetMC:MovieClip) {
    hideLoad();
    var myPic = "pic"+picNumber+"_mc";
    /*var myImg = "pic"+picNumber+".png";*/
    targetMC.active = true;
    targetMC._alpha = 50;
    targetMC.onRelease = function() {
        if(this.active == true) {
            /*_root.attachMovie("myPic", myPic, _root.getNextHighestDepth());*/
            _root.createEmptyMovieClip(myPic, _root.getNextHighestDepth());
            loadMovie("pics/pic1.png", _root[myPic]);
            
            _root[myPic].onPress = function() {
                trace("Draggin!");
                startDrag(this);
            };
            
            _root[myPic].onRelease = function() {
                stopDrag();
            };
            targetMC.active = false;
            targetMC._alpha = 100;
        }
        else {
            _root[myPic].removeMovieClip();
            targetMC.active = true;
            targetMC._alpha = 50;
        }
    }
    picNumber++;
    play();
};

```

I’m loading an external swf fine etc etc - But how do I attach the

```auto

onPress = function() {
                trace("Draggin!");
                startDrag(this);
            };
            
            onRelease = function() {
                stopDrag();
            };

```

Into the “myPic” created movieclip so that it can drag :D?

Please help :D?
