# Help with Object names and Strings

**URL:** <https://forum.kirupa.com/t/help-with-object-names-and-strings/275432>\
**Category:** flash\
**Created:** [November 13, 2008, 7:59pm UTC](https://forum.kirupa.com/t/help-with-object-names-and-strings/275432 "2008-11-13T19:59:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobcahill](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@bobcahill](https://forum.kirupa.com/u/bobcahill)\
**Post date:** [November 13, 2008, 7:59pm UTC](https://forum.kirupa.com/t/help-with-object-names-and-strings/275432/1 "2008-11-13T19:59:30Z")

</div>

function loadTarget(e:MouseEvent):void {  
trace(e.target.name);//pr1 for example  
var loadObject:Object = e.target.name + “c”  
trace(loadObject.name);// pr1c for example  
addChild(loadObject);  
}  
var pr1c:pr\_01\_01\_content = new pr\_01\_01\_content;  
pr1c.name = “pr1c”;  
var pr1:pr\_01\_01 = new pr\_01\_01;  
pr1.name = “pr1”;

for (var i:int = 0; i \< prMenuNum; i++) {  
pr\_dropdown1.pr\_01\_mc.addChild(aPr\_01\*);  
aPr\_01\*.addEventListener(MouseEvent.CLICK, loadTarget);  
}

What I need to do here is in the loadTarget receive the MouseEvent and add “c” to the end of the object name pr1. What I think is happening is that it turns it into a string and is no longer of the “object” class. Here is the Error Description:

“1118:Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:Object.” from the addChild(loadObject) line.
