PDA

View Full Version : Button Click


skippy3pt
04-15-2008, 07:46 PM
I have a button on the main time line that when clicked needs to go to the next frame then go into a movieclip and then to frame 4 of that movieclip. I just don't know what the AS would be to accomplish this. This is what I have tried, but is not working.


if(contentBookmark == 0) {
var contentBookmark:int = 1;
}

stop();
photosMC.gotoAndStop(contentBookmark);


function clickComputerBtn (evt:MouseEvent):void {
contentBookmark = photosMC.currentFrame;
gotoAndStop(5);
}

If anyone has any ideas please reply.

EDIT
Please put your code in
[ as ] [ /as ] tags (without spaces)

panel
04-16-2008, 09:58 AM
Your movieclip have to exist on the same frame as button. You can make it visible = false and instead of going to you can set visible to true.

skippy3pt
04-16-2008, 12:03 PM
Would I put that in the main time line where the movieclip lives or within the frame of movieclip that I want to go?

panel
04-16-2008, 01:34 PM
main timeline

skippy3pt
04-16-2008, 04:43 PM
How about this code? Why does it not move the playhead once I am within the movieclip?

function clickComputerBtn (evt:MouseEvent):void {
gotoAndStop(5);
photosMC.gotoAndStop(photosMC.currentFrame + 4);
}

This is the error that I get when I run the code:

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