2

I'm trying to write some code for a movie clip to make a clickable area in stage in specific frame, There is an error that i couldn't find what is that error.

"btn_SETTINGS" is a movie clip.

import flash.ui.Mouse;
import flash.events.MouseEvent;

//Stop at frame 72 (STORES PAGE)
gotoAndStop(73);

//Button SETTINGS Click
function goto_SETTINGS(event:MouseEvent):void
{
    gotoAndStop(74);
}
trace("button:",btn_SETTINGS); 
btn_SETTINGS.addEventListener(MouseEvent.CLICK, goto_SETTINGS);

Error:

 button: null
TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at APPRAYAN_fla::MainTimeline/frame72()[APPRAYAN_fla.MainTimeline::frame72:13]
Mohammad Samir
  • 211
  • 1
  • 8

1 Answers1

2

Problem is your frame number and code, That function and event listener looking for object "btn_SETTINGS" but there is no object in frame 72, separate your code to different frames.

Frame 72:

gotoAndStop(73);

Frame 73:

//Button SETTINGS Click
function goto_SETTINGS(event:MouseEvent):void
{
    gotoAndStop(74);
}
btn_SETTINGS.addEventListener(MouseEvent.CLICK, goto_SETTINGS);
Ali Kazemi
  • 505
  • 7
  • 19