actionscript 3 - How to decrement Timer variable - AS3 -
OK, I have two timer type variables in the code AS3, but there is a certain part of my game, Decrease value from them.
var tempo1: timer = new timer (4000); Var tParada: timer = new timer (2000, 1); I wonder how I can do to reduce these values, can be started from the outer classroom ...
Thank you U.
var tempo1: timer = new timer (4000)
; Tempo1.addEventListener (TimerEvent.T.M.R., Tic); Var minValue: int = 1000; Tempo1.start (); Function Tick (E: Timer Event): Zero {if (tempo1.delay - 100> = minValue) {tempo1.delay - = 100; }}
Or, if it wants to be smooth, you can do something like this:
import flash.events.TimerEvent; Import Flash. Import fl.transitions.Tween; Import fl.transitions.easing. *; Var tempo1: timer = new timer (33); // 30 times the second or so tempo1.addEventListener (TimerEvent.T.M.R., TIC); Var CalTime: Int = 4000; Tempo1.start (); Function Tick (E: Timer Event): Zero {if (tempo1.delay * tempo1.currentCount> gt; = curTickTime) {trace ("tick"); // It will effectively have a tick tempo 1. Set (); Tempo1.start (); // whatever you do on a tick}} During the / / 5 second period, in the middle of the tick delay of 100 meters from the starting price: Twil = New Twin (This, "Kurt-Time", Strong.LunchHat, Kurt-Time, 100, 5, Truth);
Comments
Post a Comment