SoundChannel null issue
In my code I frequently call a volume adjusting function where I assign new volumes to all soundchannels in use with a simple command.
The error I encounter comes when I call this function before all soundChannels have been initiated with an actual sound.
The critical part of my code is this:
var themetransform:SoundTransform = new SoundTransform(setVol);
if (SC_B != null); {
SC_B.soundTransform = themetransform; // Causes Error
}
I get an error saying “can’t access null object” or similar – and this follows after my check if the SC_B is null.
This issue only arises early in the execution of my project, that is before SC_B has been assigned to a sound_B.play() instance.
Is there any other way than comparing to null as above that I can use to prevent this error?
Please advice,
Jaxz :hr: