Animate cc error
Hi,
I am creating an animation for a touch screen with several sound sliders that control sound volume.
I is all working fine except I am getting this error for all the sliders I created
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at SinfoniasV13_3_2018530_fla::MainTimeline/onEnterFrame12()[SinfoniasV13_3_2018530_fla.MainTimeline::frame811:116]
[UnloadSWF] SinfoniasV13.3.2018530.swf
this is the code I used to control the volume:
var sliderValue:uint = (mypista1.botao1.x)/100;
var gain:caga = new caga();
var trans:SoundTransform;
trans = new SoundTransform(1, 0);
var channel:SoundChannel = gain.play(0, 100, trans);
channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
function onEnterFrame(event:Event):void
{
trans.volume =mypista1.botao1.x *0.1;
channel.soundTransform = trans; // or SoundMixer.soundTransform = trans;
}
function onPlaybackComplete(event:Event):void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
This is the bit of code giving the error although all working fine
{
trans.volume =mypista1.botao1.x *0.1;
channel.soundTransform = trans; // or SoundMixer.soundTransform = trans;
}
Thank you all in advance
Best
Ana
