I fixed the errors in the code.
The first error:
unable
is due to the fact we are trying to access a class variable that you
haven't instantiated.
Access of undefined property volumeTransform was fixed by adding:
private var volumeTransform:SoundTransform;
problem with the type coercion was fixed by wrapping the entire
percentage calculation, including the ".toFixed(2)" in a Number cast.
The toFixed() function spits out a string and was being fed into the
percentage variable that was explicitly typed as a Number.
the volume cache bug was fixed by giving the function a local
volumeCache number variable.