hi everyone, I’m new to AS3 and I cannot find a simple answer to this question and have been looking for some time now. My problem is a simple one.
I have a button symbol in the Library that I want to use later in the movie (i.e. not on frame 1!). When I get to frame 50 in my movie I want to stop the timeline and have the button appear at that point but not before. At the moment there is nothing else in my movie apart from an instance of the button named ‘button01’ placed at frame 50 on its own layer, a stop action on the timeline at frame 50 and the following code on frame 1:
button01.addEventListener(MouseEvent.CLICK, goClick, false, 0, true);
function goClick(evt:MouseEvent):void{
play();
}
Every time I run the movie I get this error:
[COLOR=#b22222]Error #1009: Cannot access a property or method of a null object reference at _004c2ActionScriptSimple_fla::MainTimeline/frame1()[_004c2ActionScriptSimple_fla.MainTimeline::frame1:6][/COLOR]
Is there something I must do to instantiate the button before I can use it later in the movie? I don’t want to have to put it on the stage at frame 1 and make it alpha=0 as I saw suggested somewhere else I’d like the button to appear only when I need it.
Now I know there must be a simple solution to this but I have searched a lot for an answer and cannot find information that addresses this exactly. I’m sorry if this has been answered already and if it has please point me in the direction of that thread and I will duly go and read it . . .