# Get 'swf name' from 'instance name'

**URL:** <https://forum.kirupa.com/t/get-swf-name-from-instance-name/109070>\
**Category:** Uncategorized\
**Created:** [May 1, 2004, 6:59pm UTC](https://forum.kirupa.com/t/get-swf-name-from-instance-name/109070 "2004-05-01T18:59:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tico](https://avatars.discourse-cdn.com/v4/letter/t/a88e57/32.png) [@tico](https://forum.kirupa.com/u/tico)\
**Post date:** [May 1, 2004, 6:59pm UTC](https://forum.kirupa.com/t/get-swf-name-from-instance-name/109070/1 "2004-05-01T18:59:31Z")

</div>

hi guys,  
i’m using a componet that make a cool effect, but it won’t let me add more function to the buttons, like loading external swf’s.  
i have 3 buttons:  
-button1 (with instance name ‘button1’ that calls button1.swf)  
-button2 (with instance name ‘button2’ that calls button2.swf)  
-button3 (with instance name ‘button3’ that calls button3.swf)

and the component get the button target with a function +/- like this:

this.btnTarget = this.\_parent[this.\_targetInstanceName]

and i wanna determine wich swf to load with a similar function.

the component code is:  
[AS]  
#initclip  
moveBtnClass = function () {  
this.init();  
};  
moveBtnClass.prototype.init = function() {  
this.btnTarget = this.\_parent[this.\_targetInstanceName];  
this.cpnt\_name = “cpnt\_move\_btn”;  
this.\_visible = false;  
if (\_global.cpnt\_move\_position\_arrayX == undefined) {  
\_global.cpnt\_move\_position\_arrayX = new Array();  
\_global.cpnt\_move\_position\_arrayX.push(this.btnTarget.\_x);  
\_global.cpnt\_move\_position\_arrayY = new Array();  
\_global.cpnt\_move\_position\_arrayY.push(this.btnTarget.\_y);  
} else {  
\_global.cpnt\_move\_position\_arrayX.push(this.btnTarget.\_x);  
\_global.cpnt\_move\_position\_arrayY.push(this.btnTarget.\_y);  
}  
this.btnTarget.onRelease = function() {  
this.positionArray = \_global.is\_btn\_horizontal ? \_global.cpnt\_move\_position\_arrayX : \_global.cpnt\_move\_position\_arrayY;  
for (i=0; !\_global.isOk && i\<\_global.cpnt\_move\_position\_arrayX.length; i++) {  
if (Math.abs(this.positionArray\*-this.\_x)\<1) {  
\_global.isOk = true;  
\_global.targetP = i;  
}  
}  
\_global.isOk = false;  
};  
};  
Object.registerClass(“moveBtn”, moveBtnClass);  
#endinitclip  
[/AS]

and i wanna add something like this:  
[AS]  
this.btnTarget.onPress=function(){  
loadMovie([color=red][function that get de instancename][/color]+ ‘.swf’,"\_root.contents\_mc");  
}  
[/AS]

help with the function that get the instancename, plz :beam:
