# Dynamically created Drag n Drop problem

**URL:** <https://forum.kirupa.com/t/dynamically-created-drag-n-drop-problem/200137>\
**Category:** flash\
**Created:** [September 8, 2006, 11:32pm UTC](https://forum.kirupa.com/t/dynamically-created-drag-n-drop-problem/200137 "2006-09-08T23:32:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AGKbrian](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@AGKbrian](https://forum.kirupa.com/u/AGKbrian)\
**Post date:** [September 8, 2006, 11:32pm UTC](https://forum.kirupa.com/t/dynamically-created-drag-n-drop-problem/200137/1 "2006-09-08T23:32:45Z")

</div>

Here is the code I have, I have got it to drag around and such, but i tried to use the drawing API to define the hotspot area but its not working. I think i missed something but i’m not seeing it. Any suggestions would be appreciated.

```auto

function makeWords(){
    
    yVar = 20
    for (i=0; i<25; i++) {
    _root.createEmptyMovieClip("symbolName"+i, getNextHighestDepth());
    with (this["symbolName"+i]){
        createTextField("drag", 1, 0, 0, 160, 20);
        drag.text = symbol*[1];
        _x = 325
        _y = yVar
        drag.border = true;
        drag.setTextFormat(textFormat);
        // Draw a rectangle in hit_mc
        
    }
    this["symbolName"+i].createEmptyMovieClip("hitSpot"+i, getNextHighestDepth());
    with (this["symbolName"+i]["hitSpot"+i]){
        moveTo(0,0); 
        beginFill(0xFF0000,10);
        lineTo(80, 0);
        lineTo(80, 10);
        lineTo(0, 10);
        lineTo(0, 0);
        endFill( );
        hitArea = this["symbolName"+i]["hitSpot"+i];
    }

    yVar = yVar +14

    this["symbolName"+i].onPress = function ( ) {
        startDrag(this, true);
        }
    this["symbolName"+i].onRelease = function ( ) {
        stopDrag();
        this.stopThis(i);
        }
    }
}

```
