Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-20-2008, 09:43 AM   #1
Registered User
Join Date: Jun 2008
Posts: 1
Unhappy help creating a game timer


I want to create a timer for my game.

I want to create levels in my game for 1 minute time for each level.

but i'm not able to create the same, in the code below, I want the time should return after "onEnterFrame" finish.. but it returns value before deletion of "onEnterFrame" and executes "onEnterFrame" till deletion.

I'm using this code: -

function curTime()
var myTime:Number;

myTime = getTimer();
return myTime;

function createTimer ()

time = curTime();
oldTime = time;

MovieClip.prototype.onEnterFrame = function ()
time = curTime();
trace("current time = "+time);
if ((time-oldTime)>600)
trace("working in if = "+time);
time = time-oldTime;
delete MovieClip.prototype.onEnterFrame;
return time;
bhupi_99000 is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[AS2] Creating password system for a game renik Gaming and Game Development 1 06-20-2006 03:09 PM
[AS2] Card Game (turn-based) - Lobby Room and Game Room, maintain state cururu Gaming and Game Development 3 05-20-2006 02:06 AM
game timer help gruff55 Gaming and Game Development 1 12-31-2005 05:20 PM
how would i go about creating a warioware type game? [email protected] Gaming and Game Development 1 03-27-2005 11:51 AM
how to add timer for drag & drop game.. booniraj Gaming and Game Development 3 10-15-2003 04:43 AM

All times are GMT. The time now is 02:03 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.