# AS2 - Getting a function to "see" a string variable

**URL:** <https://forum.kirupa.com/t/as2-getting-a-function-to-see-a-string-variable/331035>\
**Category:** flash\
**Created:** [April 30, 2013, 6:32pm UTC](https://forum.kirupa.com/t/as2-getting-a-function-to-see-a-string-variable/331035 "2013-04-30T18:32:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skarab](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@Skarab](https://forum.kirupa.com/u/Skarab)\
**Post date:** [April 30, 2013, 6:32pm UTC](https://forum.kirupa.com/t/as2-getting-a-function-to-see-a-string-variable/331035/1 "2013-04-30T18:32:43Z")

</div>

I’m trying to simplify some code by writing a block of code using a string variable, and then using that function at various places on a timeline where slideshows need to appear. Each slideshow is named for the date things occurred on, so they have names like “apr2\_12Slideshow\_mc”.

I created a variable like this:

```auto
var dateName:String = "apr2_12Slideshow_mc";

```

Then the function which looks like:

```auto
callout_mc.next_btn.onRelease = function(){
    new Tween(_parent.dateName, "_y", Strong.easeInOut, 640, 0, 1, true);

```

But the function code WILL NOT see the variable. I’ve tried writing it numerous ways and tried putting it in different locations but I can’t get it to function.

I did test by using the actual slideshow name and it worked fine. But I cannot get it to see the string variable. I have a feeling I’ve got the syntax wrong somehow but I can’t see where the problem is.

Thanks for any comments!
