Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Animate cc error

Explorer ,
May 31, 2018 May 31, 2018

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

1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2018 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 31, 2018 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2018 May 31, 2018

what's:

trace(trans);

trace(mypista1);

trace(mypista1.bataol)

prior to that line of code show?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 31, 2018 May 31, 2018

Sorry, I don’t understand your question

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 31, 2018 May 31, 2018

Ok, I understood now...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 31, 2018 May 31, 2018

Prior to that line of code I don t have any code in that frame.

I have a symbol (mypista1) that works as a volume slider, and inside it, two symbols the knob (botao1) and the slider  guide (pista1) with the code for the knob movement.

The trans was originally in the code that I got from a tutorial   ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2018 May 31, 2018

add those 3 trace statements prior to the problematic line of code.

what's the output panel show?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 31, 2018 May 31, 2018

[object SoundTransform]

[object mypista_31]

undefined

this is what the panel shows, like a million times ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2018 May 31, 2018

when your code executes, there's a mypista1 object, but not a mypista1.bataol.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2018 Jun 01, 2018

Sorry about the dumb question... but...

How do I solve it??

There is a mypista1 object and inside it there is the botao1 object and the pista1 object...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2018 Jun 01, 2018

what main timeline frame contains mypista1?

what mypista1 frame contains botao1?

is botao1 part of a tween and is it ever removed from mypista1's timeline?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2018 Jun 01, 2018

what main timeline frame contains mypista1?

744

what mypista1 frame contains botao1?

1

is botao1 part of a tween and is it ever removed from mypista1's timeline?

No

I can explain you a bit better the project if it helps:

I have several volume slides (mypista1, mypista2, etc) in the same frame in timeline.

The knop (botao1) moves in the balk (pista1) in the frame 1 of mypista with this code:

var knobWidth:Number = botao1.width;

var trackWidth:Number = pista1.width;

var trackX:Number = pista1.x;

var boundWidth = trackWidth - knobWidth;

var boundsRect:Rectangle = new Rectangle(trackX, 0, boundWidth, 0);

//beginpositie sliderKnob

botao1.x =270;

//Enable drag

botao1.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);

function startDragging(event:MouseEvent) {

    botao1.startDrag(false, boundsRect);

}

//Stop drag

botao1.addEventListener(MouseEvent.MOUSE_UP, stopDragging);

//knop.addEventListener(MouseEvent.ROLL_OUT, stopDragging);

function stopDragging(event:MouseEvent) {

botao1.stopDrag();

}

//onRealeaseOutside

stage.addEventListener(MouseEvent.MOUSE_UP,upStage);

function upStage(e:MouseEvent):void {

stopDrag();

}

Each slide (mypista1) controls a different volume whith this code:

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);

}

All works fine in terms of sound. But when I test it the error appear after pressing a go back button (gotoAndStop)

Thank you sooooo much for trying to help me ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2018 Jun 01, 2018

do you see the error every time the frame that contains that code displays?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2018 Jun 01, 2018

No, Just when I press the go back button...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2018 Jun 01, 2018

i don't see any way to determine the problem via a forum.  imo someone will need to download and fix your fla.

but maybe someone else can figure it out.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 01, 2018 Jun 01, 2018

Thank you very much any way... I'll keep trying to solve the problem, or try to find a different code to play the sounds and changing volumes.

Best regards

AB

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2018 Jun 01, 2018
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines