String reference to sound channel

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:



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:


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!

…hold on, its probably something with getDefinitionByName

Investigating as we speak ; )

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