Skip to main content
Participant
April 14, 2014
Question

Simple script : Still Error #1009 --> Not using Actions in frame 2?

  • April 14, 2014
  • 1 reply
  • 303 views

Hi,

I get this error:

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

          at Untitled_fla::MainTimeline/frame1()

And i think it is because of the fact that Actions are only in frame 1 and not in 2.

But how do i get Actions to work in frame 2 as well?

This is my code:


stop();

import flash.display.MovieClip;

import flash.events.MouseEvent;

var button1 : MovieClip =button1Mc;

var button2 : MovieClip =button2Mc;

button1.stop();

button2.stop();

button1.addEventListener(MouseEvent.CLICK,goto2);

button2.addEventListener(MouseEvent.CLICK,goto3);

function goto2(e:MouseEvent):void {

          gotoAndStop(2,"Scene 1");

}

function goto3(e:MouseEvent):void {

          gotoAndStop(1,"Scene 1");

}

Can anybody tell me how to get it to work?  

Merel


This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 14, 2014

if the error's from something in that code, either button1Mc or button2Mc don't exist when that code executes.

click file>publish settings>swf and tick 'permit debugging'.  retest.

the problematic line number will be in the error message allowing you to pinpoint the problem and then correct it.

Participant
April 14, 2014

Thank you!

It works now. I figgured it out!

Have a nice day!

kglad
Community Expert
Community Expert
April 14, 2014

you're welcome.