# How to reference a Sprite with a String

**URL:** <https://forum.kirupa.com/t/how-to-reference-a-sprite-with-a-string/282398>\
**Category:** flash\
**Created:** [February 21, 2009, 1:16pm UTC](https://forum.kirupa.com/t/how-to-reference-a-sprite-with-a-string/282398 "2009-02-21T13:16:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robsan12](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@robsan12](https://forum.kirupa.com/u/robsan12)\
**Post date:** [February 21, 2009, 1:16pm UTC](https://forum.kirupa.com/t/how-to-reference-a-sprite-with-a-string/282398/1 "2009-02-21T13:16:07Z")

</div>

I cant get the **this[]** keyword to work.

I want to send a string to a function and then, via the string reference a Sprite. Are theire any other ways to adress a sprite with a String value?

I thought **this[myString].alpha = 0.5;** was gonna do the trick but i keep getting (1010: A term is undefined and has no properties.). I tried every possible solution it feels like. Delaring Strings locally and Global…but i can´t get it to work. And the String is well spelled btw!

```php
//Nothing Works
this["myString"].alpha = 0.5;
this[myString].alpha = 0.5;

//Anyway to reference a Sprite with a String???

```

Anyone…???
