Leonsbuddydave
08-28-2009, 07:41 PM
I'm new to Actionscript (3), and I'm trying to build a music player from the ground up. I've gotten a lot of it done without a problem, but the volume slider is giving me some troubles. This code right here:
function adjustVolume(e:Event):void {
var vol:Number = volume_mc.slider_mc.x/100;
trace(vol);
var st:SoundTransform = new SoundTransform(vol);
if (this._parent.channel!=null) {
this._parent.channel.soundTransform = vol;
}
}
throws this error:
TypeError: Error #1010: A term is undefined and has no properties.
at mediaplayer_fla::MainTimeline/adjustVolume()
whenever I move the slider. The trace() is outputting the right numbers when I move the slider, but the volume is not getting changed. Can anyone explain what I'm doing wrong and tell me what to do to fix it?
function adjustVolume(e:Event):void {
var vol:Number = volume_mc.slider_mc.x/100;
trace(vol);
var st:SoundTransform = new SoundTransform(vol);
if (this._parent.channel!=null) {
this._parent.channel.soundTransform = vol;
}
}
throws this error:
TypeError: Error #1010: A term is undefined and has no properties.
at mediaplayer_fla::MainTimeline/adjustVolume()
whenever I move the slider. The trace() is outputting the right numbers when I move the slider, but the volume is not getting changed. Can anyone explain what I'm doing wrong and tell me what to do to fix it?