# Sound "getDefinitionByName"

**URL:** <https://forum.kirupa.com/t/sound-getdefinitionbyname/330071>\
**Category:** Uncategorized\
**Created:** [November 26, 2012, 12:16pm UTC](https://forum.kirupa.com/t/sound-getdefinitionbyname/330071 "2012-11-26T12:16:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eva\_tw](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@eva\_tw](https://forum.kirupa.com/u/eva_tw)\
**Post date:** [November 26, 2012, 12:16pm UTC](https://forum.kirupa.com/t/sound-getdefinitionbyname/330071/1 "2012-11-26T12:16:23Z")

</div>

Hi all,

In my code I need something to call the right soundfile from an array, like how I call a MC in the code below:

```auto

var currentBTN:String = event.currentTarget.name;
var currentMC:MovieClip = getChildByName ("mc_" + currentBTN) as MovieClip;

```

I tried that with:

```auto

var currentSND:Sound = getDefinitionByName ("snd_" + currentBTN) as Sound;

```

and:

```auto

var snd_name:Class = getDefinitionByName ("snd_" + currentBTN) as Class;
var currentSND:Sound = new snd_name();

```

but both don’t seem to work. I get the following error: #1065 variable snd\_screenen is not defined. However I did define it, earlier in the code with:

```auto

var snd_screenen:Sound = new SCREENEN();
var snd_behandelen:Sound = new BEHANDELEN();

```

And I also gave de sounds a class name in my library. So I’m out of options…
