Steve Brame
asked on
Trying to return to menu after video ends
I have a very simple bit of AS3 that I can't get to work. I have 4 FLVPlayBack's on 4 frames, buttons on a menu to go to the frames to play the videos, and I need to return to the menu's frame after the videos end. Here's what I have. The buttons to play the videos work, but the function to return to the menu isn't firing. I'm also getting this error as the program starts. Not sure if this has anything to do with it.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at haverintheamericas_fla::Ma inTimeline /frame1()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at haverintheamericas_fla::Ma
iimport fl.video.VideoEvent;
stop();
//button listeners
btn_tour.addEventListener(MouseEvent.CLICK, tourClick);
btn_history.addEventListener(MouseEvent.CLICK, historyClick);
btn_quality.addEventListener(MouseEvent.CLICK, qualityClick);
btn_song.addEventListener(MouseEvent.CLICK, songClick);
//video end listeners
tourVideo.addEventListener(VideoEvent.COMPLETE, backtomenu);
historyVideo.addEventListener(VideoEvent.COMPLETE, backtomenu);
qualityVideo.addEventListener(VideoEvent.COMPLETE, backtomenu);
songVideo.addEventListener(VideoEvent.COMPLETE, backtomenu);
//button functions
function tourClick(event:MouseEvent):void{ gotoAndStop("tour"); };
function historyClick(event:MouseEvent):void{ gotoAndStop("history"); };
function qualityClick(event:MouseEvent):void{ gotoAndStop("quality"); };
function songClick(event:MouseEvent):void{ gotoAndStop("song"); };
//head back to menu function
backtomenu(){
trace ("Video ended!");
gotoAndStop("menu");
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah, I'd had a revelation about an hour ago that the functions needed to be on the frames that held the FLVPlayBacks. This was after an all-nighter. It's a wonder I can even read at this point.
Everything's working now. Thanks a lot!