PDA

View Full Version : Adding a Delay/pause to the actions layer


NathanStryker
02-09-2009, 05:22 PM
Hi All-

Anybody out there familiar with Flash CS3 I have what I think is a fairly simple question that I would love some help with.

I have a 2 frame SWF that plays an external movie... the movie is about an hour long, so I want to hide the "next" button until a time when most of the movie has played. Then when the next button is clicked i want the movie to move to the next frame and play ... .

So what I have is this in my actions layer:
Quote:
stop();
nextButton_btn.visible=false;

nextButton_btn.visible=true;

addEventListener(MouseEvent.CLICK, nextPage);

function nextPage(e:Event)
{
gotoAndPlay(2);
}
I need to know what i need to put after btn visible=false; to delay it a set time amount before continuing...

cjx3711
02-10-2009, 06:24 AM
You could set a counter in flash
Make a variable and a movieclip
You need to create 3 frames for this.
On frame 1
variable = 0;
on frame 2, put your long movie and
stop();
nextButton_btn.visible=false;
on frame 3, put the rest of thee rest of your code
nextButton_btn.visible=true;

addEventListener(MouseEvent.CLICK, nextPage);

function nextPage(e:Event)
{
gotoAndPlay(2);
}


on frame 24 in your movieclip (assuming that your fps is 24) increase the variable by 1.

on the frame in the movieclip, put
_root.variable += 1
if(_root.variable == 20) { // 20 means 20 seconds
_root.gotoAndPlay(3)
}

kkbbcute
02-10-2009, 07:56 AM
Or you could use an onEnterFrame function.

http://www.actionscript.org/forums/showthread.php3?t=196598

Here's an example.