# Hi.. help with variables

**URL:** <https://forum.kirupa.com/t/hi-help-with-variables/178788>\
**Category:** flash\
**Created:** [February 14, 2006, 8:47am UTC](https://forum.kirupa.com/t/hi-help-with-variables/178788 "2006-02-14T08:47:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kcancert](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@kcancert](https://forum.kirupa.com/u/kcancert)\
**Post date:** [February 14, 2006, 8:47am UTC](https://forum.kirupa.com/t/hi-help-with-variables/178788/1 "2006-02-14T08:47:49Z")

</div>

var k = “0”; - This is my first frame.

On the screen I have 4 buttons and an empty movie clip with instance name - container.

btn1  
btn2  
btn3  
btn4  
Each button has following script -

on (release) {  
play();  
k = 1  
}

Value of k changes with the button.

eg. btn3 has k = 3; btn4 has k = 4

The last frame has following script -

container.loadMovie(k+".swf");

I want to make this function such, that instead of putting in each button - k = 1 or k = 2 or k = 3… I want to compile one common script where value of k gets recognized from the instance name of the button so that… value of k when u hit button 4 is identified from the btn4.

Can some one help? The source file can be downloaded [here](http://www.kcalpesh.com/demo.zip).

If possible modify my file and attach.

Regards,
