Simple countdown production

zhaozj2021-02-17  49

I want to briefly introduce the countdown control. I think everyone will find it when you do a game, the countdown is very important for the game, but why should we control it in Flash? Here we only need to take advantage of gettime to make it easy!

Let's first create an empty frame of the MC, name GetTime, and then placed it in the main scene. Next, the code we need to enter is only (below

Code content in the Actions for gettime):

Actions for frame 1

STOP ();

Fscommand ("Allowscale", "0");

Actions for frame 2

STOP ();

Actions for BT

On (Release) {

GotoandPlay (1);

}

Actions for gettime

OnClipEvent (LOAD) {

Firsttime = getTimer ();

}

OnClipEvent (Enterframe) {

NOWTIME = GetTimer ();

TimeValue = NOWTIME-FIRSTTIME;

_root.time_text = 10-math.ceil (TimeValue / 1000);

IF (TimeValue> = 10000) {

_Root.nextFrame ();

}

}

From getTime (MC) code we can sum, we record a firsttime variable when the MC is loaded, then use the MC's EnterFrame, we will constantly changing the time to the firstTIME to compare, when this compare value When it is equal to a value you need, make a corresponding other operations, such a simple time countdown to complete this!

转载请注明原文地址:https://www.9cbs.com/read-29317.html

New Post(0)