Error 1009 in Action Script 3. Help!
When I try playing my movie, I get
“TypeError: Error #1009: Cannot access a property or method of a null object reference.at RhettMovie_fla::MainTimeline/showsmokescene()
The error pops up when I click each of the four buttons, which are supposed to each start playing a different symbol. Help!!
Here’s my ActionScript:
import flash.events.MouseEvent;
// make the characters invisible
birthdayscene.visible = false;
dancescene.visible = false;
trippyscene.visible = false;
smokescene.visible = false;
// tell both scenes to stop animating
birthdayscene.stop();
dancescene.stop();
trippyscene.stop();
smokescene.stop();
// set up our buttons
btn1.addEventListener(MouseEvent.CLICK, showsmokescene);
btn2.addEventListener(MouseEvent.CLICK, showdancescene);
btn3.addEventListener(MouseEvent.CLICK, showtrippyscene);
btn4.addEventListener(MouseEvent.CLICK, showbirthdayscene);
// commands for making things visible and invisible
function showsmokescene(event:MouseEvent)
{
smokescene.visible = true;
smokescene.play();
dancescene.visible = false;
dancescene.stop();
trippyscene.visible = false;
trippyscene.stop();
birthdayscene.visible = false;
birthdayscene.stop();
}
function showdancescene(event:MouseEvent)
{
dancescene.visible = true;
dancescene.gotoAndPlay(1);
smokescene.visible = false;
smokescene.stop();
trippyscene.visible = false;
trippyscene.stop();
birthdayscene.visible = false;
birthdayscene.stop();
}
function showtrippyscene(event:MouseEvent)
{
trippyscene.visible = true;
trippyscene.gotoAndPlay(1);
smokescene.visible = false;
smokescene.stop();
dancescene.visible = false;
dancescene.stop();
birthdayscene.visible = false;
birthdayscene.stop();
}
function showbirthdayscene(event:MouseEvent)
{
birthdayscene.visible = true;
birthdayscene.gotoAndPlay(1);
smokescene.visible = false;
smokescene.stop();
dancescene.visible = false;
dancescene.stop();
trippyscene.visible = false;
trippyscene.stop();
}