Refrencing objects that are not present on frame 1 of a movieclip
Hi everyone!
I'm working with a movieclip right now that has two frames in it. I want the user to be able to go back and forth between the pages by clicking on tabs on either page. The button that they click on is only present on the frame that it is applicable (so, the button to switch to frame 2 is only present on frame 1, and vice versa).
I want to control when they are able to click back and forth, and be able to turn the buttons on and off whenever I need to, but since the button to switch back to frame 1 is only on frame 2, when I reference it from the main timeline, the button registers as a null object. How do I refrence an object that is not present on the first frame of a clip?
Here's the gist of what I have. The main timeline has an object called "mAccess" that has 2 frames, Windows and Reports. At the top there are two tabs, one for Windows, one for Reports. The Windows tab is only clickable when on the Reports frame (frame 2) and the Reports tab is only clickable when on the Windows frame (frame 1)
Main Timeline:
mAccess.bReports.addEventListener(MouseEvent.CLICK, gotoreportstab);
function gotoreportstab(event:MouseEvent) {
mAccess.gotoAndStop(2);
}
mAccess.bWindows.addEventListener(MouseEvent.CLICK, gotowindowstab); <--- This gives me the error about the null object reference,
function gotowindowstab(event:MouseEvent) { since bWindows does not exist on frame 1 of mAccess.
mAccess.gotoAndStop(1);
}
Thanks for whatever help you can give me!