# Vars and Arrays

**URL:** <https://forum.kirupa.com/t/vars-and-arrays/245654>\
**Category:** flash\
**Created:** [December 2, 2007, 4:01pm UTC](https://forum.kirupa.com/t/vars-and-arrays/245654 "2007-12-02T16:01:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [December 2, 2007, 4:01pm UTC](https://forum.kirupa.com/t/vars-and-arrays/245654/1 "2007-12-02T16:01:30Z")

</div>

hello,

I am trying to understand the following code:

```auto

var desc:Array = new Array();

btn_mc.onRelease = function(){
    var link:String = "this.html";
    desc.push(link);
    trace(desc);
}

```

Simple enough, var desc will contain the string “this.html”.

However what is boggling me is when I do this…\> (I get the var ‘link’ as undefined)

```auto

var desc:Array = new Array();

function hitme(){
    desc.push(link);
}

btn_mc.onRelease = function(){
    var link:String = "this.html";
    hitme(); 
}

```

I want to do this, so that each button has its own string, which then gets pushed into the hitme function, which in the end will direct the hit to getURL and move to a new web page.

Alas why am I losing the ‘link’ variable?!  
And how can I solve it?:te:
