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

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

New Here ,
Apr 14, 2014 Apr 14, 2014

Copy link to clipboard

Copied

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


TOPICS
ActionScript

Views

263

Translate

Translate

Report

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 ,
Apr 14, 2014 Apr 14, 2014

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
New Here ,
Apr 14, 2014 Apr 14, 2014

Copy link to clipboard

Copied

Thank you!

It works now. I figgured it out!

Have a nice day!

Votes

Translate

Translate

Report

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 ,
Apr 14, 2014 Apr 14, 2014

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

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