# Problem accessing text field using droptarget

**URL:** <https://forum.kirupa.com/t/problem-accessing-text-field-using-droptarget/251418>\
**Category:** flash\
**Created:** [February 8, 2008, 5:05am UTC](https://forum.kirupa.com/t/problem-accessing-text-field-using-droptarget/251418 "2008-02-08T05:05:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaji](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@shaji](https://forum.kirupa.com/u/shaji)\
**Post date:** [February 8, 2008, 5:05am UTC](https://forum.kirupa.com/t/problem-accessing-text-field-using-droptarget/251418/1 "2008-02-08T05:05:57Z")

</div>

Hi All  
I have a flash application which is kind of quiz game. User has to drag and drop the option in appropriate location. Options and questions are movie clips on stage with text field, when I drag and drop the option on question I am unable to retrieve the text field content of the question. However I am able to retrieve textfield content of option.

```auto

 
function drag(evt:MouseEvent) {
 trace("target name is "+evt.target.parent.name); \	arget name is o0
 var textName:String=evt.target.parent.name;
 var targetName:DisplayObject=getChildByName(textName);
 trace(targetName.sname.text);
 startx=evt.target.parent.x;
 starty=evt.target.parent.y;
 targetName.startDrag(true);
}
function drop(evt:MouseEvent) {
 var textName:String=evt.target.parent.name;
 var targetName:DisplayObject=getChildByName(textName);
 targetName.stopDrag();
 trace(targetName.x +" "+targetName.y); \\65 60
 evt.target.parent.x=startx;
 evt.target.parent.y=starty;
 trace("target name is "+targetName.dropTarget.name); \	arget name is instance20
 var dropTargetN:String=targetName.dropTarget.name;      
 trace("dropTargetN "+dropTargetN); \\dropTargetN instance20
 var dropTargetName:DisplayObject=getChildByName(dropTargetN);
 trace("Text of droptarget "+dropTargetName); \\Text of droptarget null
}

 

```

Trace of above code shows

```auto

 
target name is o0
Cu
65 60
target name is instance20
dropTargetN instance20
Text of droptarget null

```

How do I get the text field content of the questions? I have tried adding the options and questions on stage programatically too. Any help would be appreciated.

Thanks in advance
