Right-click the text sprite and select Script from the context menu. Delete the default mouseUp handler and add the following: property myCount on beginSprite me the floatPrecision = 2 _movie.startTimer() myCount = 0 end on enterFrame me if myCount = 10 then currTime = _movie.timer secTime = currTime / 60.0 sprite(me.spriteNum).member.text = "Time:" && string(secTime) myCount = 0 else myCount = myCount + 1 end if end First, the myCount property is defined. This will be used as a way to update the on-screen timer display every ten frames. Setting the text of a cast member isn't the speediest thing in the world, so you don't want to do it on every frame if you can help it. Doing it every ten frames won't be noticeable in the display, but the rotations of the cards will be smoother. Within beginSprite, the first line of Lingo sets the floatPrecision to 2 (by default it is 4). The movie property floatPrecision affects how floating-point numbers are displayed. It doesn't at all affect how they are calculated, however; calculations are processed in full precision regardless of this setting. What the setting really does is affect how many decimal places in a floating-point number are displayed. For example, look at the following taken from the Message window: the floatPrecision = 4 trace (22 / 7.0) -- 3.1429 the floatPrecision = 2 trace(22 / 7.0) -- 3.14 As you can see, by setting it to 2, only two decimal places are displayed. The next line of code calls the movie's startTimer method, which initializes the timer and sets it to zero ticks. Finally, myCount is initialized to 0. Within the enterFrame handler, the first line of code checks to see if myCount has reached 10. When it has, the code first gets the current value of the timer and places it into the currTime variable. It is then divided by 60.0, because there are 60 ticks in a second, to get the number of elapsed seconds. The text of the member is then set to the time string and myCount is reset back to 0. When myCount is not yet 10 the code within the else gets executed and myCount simply gets incremented by 1. |