Skip to main content
Inspiring
May 31, 2018
Question

Animate cc error

  • May 31, 2018
  • 17 replies
  • 1290 views

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

    This topic is closed to new replies. Start a new post to keep the conversation going.

    17 replies

    kglad
    Community Expert
    Community Expert
    May 31, 2018

    line 116, frame 811 is trying to reference an object that doesn't exist.

    if that's not enough help, what line is that?

    ATGBAuthor
    Inspiring
    May 31, 2018

    Hi, thank you for the answer.

    I had already identified the line, sorry I didn’t mention that at the beginning.

    That line correspond to:

    trans.volume=mypista1.botão1.x *0.1

    I can’t fint what’s wrong whit it.

    mypista1 is the name I gave to the symbol that has the slider and the volume button (botao1).

    the error only appears when I publish it.

    thanks again

    best

    Ana

    kglad
    Community Expert
    Community Expert
    May 31, 2018

    what's:

    trace(trans);

    trace(mypista1);

    trace(mypista1.bataol)

    prior to that line of code show?