PDA

View Full Version : frame navigation with button


kotajurmi
11-09-2009, 03:30 PM
I am a total newbie with AS, I have this error...
please help

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at all_new_fla::MainTimeline/frame1()

stop();
import flash.events.MouseEvent;

gasa_btn.addEventListener(MouseEvent.CLICK, gasaStats);

function gasaStats(event:MouseEvent):void{
gotoAndStop("gasa");
}

thimphu_btn.addEventListener(MouseEvent.CLICK, thimphuStats);

function thimphuStats(event:MouseEvent):void{
gotoAndStop("thimphu");
}

back_btn.addEventListener(MouseEvent.CLICK, backHome);

function backHome(event:MouseEvent):void{
gotoAndPlay(1);
}

henke37
11-09-2009, 06:13 PM
Run in the debugger and get a meaningfull error message, mentioning what line is the offending one and giving you a chance to figure out what is null by examining the variables.

raghu_thejus
11-10-2009, 04:39 AM
if u r writing code in main tiimeline,there is no need to use import statement.
the error is mainly because u haven't given instance name properly.