Skip to main content
Participating Frequently
February 23, 2014
Question

TypeError: Error #1009 issue throughout

  • February 23, 2014
  • 1 reply
  • 870 views

Hi,

I'm having this issue throughout my program. I'm not well versed in Flash. Here's the code:

import flash.events.MouseEvent;

stop();

emer_cont_btn.enabled = true;

emer_exit_btn.enabled = true;

emer_help_btn.enabled = true;

emer_glossary_btn.enabled = true;

emer_mm_btn.enabled = true;

emer_btn.enabled = true;

emer_cont_btn.addEventListener(MouseEvent.CLICK, Cont2e);

function Cont2e(event:MouseEvent):void

{

          emerstory01.stop();

          gotoAndStop("3E");

}

emer_btn.addEventListener(MouseEvent.CLICK, Emer2e);

function Emer2e(event:MouseEvent):void

{

          emerstory01.stop();

          gotoAndStop("1E","Emer");

}

emer_exit_btn.addEventListener(MouseEvent.CLICK, Scene2e);

function Scene2e(event:MouseEvent):void

{

          emerstory01.stop();

          gotoAndStop("one","Scene2");

}

emer_mm_btn.addEventListener(MouseEvent.CLICK, MainMenu2e);

function MainMenu2e(event:MouseEvent):void

{

          emerstory01.stop();

          gotoAndStop("onea","MainMenu");

}

emer_help_btn.addEventListener(MouseEvent.CLICK, Help2e);

function Help2e(event:MouseEvent):void

{

          emerstory01.stop();

          gotoAndStop("oneb","Help");

}

emer_glossary_btn.addEventListener(MouseEvent.CLICK, Glossary2e);

function Glossary2e(event:MouseEvent):void

{

          emerstory01.stop();

          gotoAndStop("onec","Glossary");

}

I'm pulling the video from an external source and when I click continue the video doesn't stop and keeps playing. Is there a way to write this so that no matter what link/button I click the video stops playing?? I will need to do this throughout my program it seems so any help would be amazing!!!

Here's the errors I got for this output:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at MySafeSchool_fla::MainTimeline/Emer2e()

TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at MySafeSchool_fla::MainTimeline/Cont2e()

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 23, 2014

emerstory01 doesn't exist when Emer2e() executes.

(for more complex situations you can pinpoint the line number with the error by clicking file>publish settings>swf and ticking permit debugging.  the problematic line number will be in the error message).

slewis818Author
Participating Frequently
February 24, 2014

That makes sense now! How do I make it exist so that it stops running when the user clicks the different buttons? FOr instance, when they click the continue button the movie emerstory01 stops playing. I want it to stop if the user clicks the Fire button instead of Continue. What would the code be to make that movie stop no matter what button they click?

kglad
Community Expert
Community Expert
February 24, 2014

emerstory01.stop(); is the correct code to stop emerstory01 from playing, but you should NOT execute that code when emerstory01 no longer exists.  and it probably no longer exists when the main timeline changes frames.