# String reference to sound channel

**URL:** <https://forum.kirupa.com/t/string-reference-to-sound-channel/263506>\
**Category:** flash\
**Created:** [June 16, 2008, 6:48pm UTC](https://forum.kirupa.com/t/string-reference-to-sound-channel/263506 "2008-06-16T18:48:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![0L4F](https://avatars.discourse-cdn.com/v4/letter/0/848f3c/32.png) [@0L4F](https://forum.kirupa.com/u/0L4F)\
**Post date:** [June 16, 2008, 6:48pm UTC](https://forum.kirupa.com/t/string-reference-to-sound-channel/263506/1 "2008-06-16T18:48:33Z")

</div>

Hello coKirupas,

Things are well on the as3-learning front, yet I’m running into a new problem. I need to reference to a sound channel using a string. My code is something like this:

```auto

var chLoop:SoundChannel;
chLoop = sndLoop.play(0, 999);

```

…and this works, the channel is playing. But then, later on, I need a construction like this:

```auto

var trans:SoundTransform = new SoundTransform();
trans.volume = 0.5;

var sChannel:String = "ch" + sCurrentSound;   

* // sChannel is now "chLoop"*

this[sChannel].soundTransform = trans;

```

…and that last line throws Error #1010: A term is undefined and has no properties.  
Is there another way to reference a sound channel using a string…?

Thanks!

---

<div class="post-metadata">

**Author:** ![0L4F](https://avatars.discourse-cdn.com/v4/letter/0/848f3c/32.png) [@0L4F](https://forum.kirupa.com/u/0L4F)\
**Post date:** [June 16, 2008, 7:08pm UTC](https://forum.kirupa.com/t/string-reference-to-sound-channel/263506/2 "2008-06-16T19:08:23Z")

</div>

…hold on, its probably something with **getDefinitionByName** …

Investigating as we speak ; )

---

<div class="post-metadata">

**Author:** ![Felixz](https://avatars.discourse-cdn.com/v4/letter/f/ecb155/32.png) [@Felixz](https://forum.kirupa.com/u/Felixz)\
**Post date:** [June 17, 2008, 2:56pm UTC](https://forum.kirupa.com/t/string-reference-to-sound-channel/263506/3 "2008-06-17T14:56:23Z")

</div>

No the problem is that object holding reference to soundChannel should be dynamic.
