Create a Timer, but having problems...

Hey! I'm new to the fourms and newish Flash. I make a game where I want to have a timer running in each level (4 in total). When the user has finished the game, I want the timer to stop and view their time.


I have 2 dynamic text boxes with the varibles to them as "Seconds" and the other as "Min". Here is the ActionScript code I have for it right now:



Var seconds = 0;

var Min = 0;


Timer (): Void

{

_root. Seconds += 1;

}


setInterval (timer, 1000)


All this is done for me, gives me a box counting upwards forever. From what I have learned, it's much better to try and write AS outside as if your spoke first, then try to encode. Here's what I want to do then (in theory):

If var "seconds" = 60 (1 minute), then reset var "seconds" down to zero. Then, add one to var Min.

How can I code this?

Then, after the user has reached the level 4, got to the end, how would stop the stopwatch?


Thank you!
Tobin

I would recommend that you avoid using the variable aspect of textfields and just assign them an instance name and assign values using the text property of the textfields.  But see if it works for you for now.

Var seconds = 0;

var Min = 0;

Timer (): Void

{

Seconds += 1;
if(seconds == 60) {}
Seconds = 0;
Min += 1;
}

}

var intervalID = setInterval (timer, 1000);

When you get to the fourth level and you want to stop the interval, use...

clearInterval (intervalID);

Tags: Adobe Animate

Similar Questions

  • I have to remove the duplicate files, but having problems by selecting more than one file in the player at the time.

    I have to remove the duplicate files, but having problems by selecting more than one file in the player at the time. How can I select multiple files at the same time so I can just delete them. I used to be able to do this in previous versions of Media Player, but this function seems now blocked or unavailable. The problem is this: through previous use of media player, it plays all my multimedia files several times whenever a device support has been added. He would try to save the files on my main drive, but since there is not enough room this would save the files somewhere else. This happened several times, I suppose, because when I upgraded my computer and a media scan was conducted he found duplicates of all my media various times of at least 6-8. I've consolidated since my plates on 3-disc multi to, but have now records duplicated hundreds and thousands of duplicate media files. Previous versions of Media Player would allow me to select all files and then delete them both of the reader, but also from my hard drive. So now I'm stuck with more than 300 GB of duplicate media I have to search line by line through all my hard drives to find each duplicate both, unless I can get media player to do what it can. Any help in this area would be appreciated.

    Hello

    1. did you of recent changes on the computer?

    2. is Windows media player files in double creation during playback of music files?

    To delete duplicate entries, click on another feature tab in the drive (for example the current playback), and then click library.

    If this does not remove duplicates from your library, you can use the Add to library dialog box to search computer to analyze a file on your computer the duplicate entries not valid-pointing. The player will remove invalid entries in your library that point to files that no longer exist in the folder.

    Complete the steps above for files that are stored in the hard disks.

    Method 1: Use the add to Library dialog box search for computers

    (a) start Windows Media Player.

    (b) press F3 on your keyboard to open Add to the library of the find computers dialog box.

    (c) click the Browse button to locate the folder on your computer so that your library contains invalid entries. Specify the location of the folder in the box look in.

    If you are not sure what duplicate in your library entry is not valid, you can add a path column to display in your library. Specify the folder on your computer that corresponds to the path not valid file displayed in your library.

    (d) click on the Search button.

    The player will search for digital media files and playlists in the folder that you specify and remove invalid entries in your library that point to files that no longer exist in the folder. If not valid in double entries point to other folders on your computer, repeat this procedure, specify a different folder every time.

    If only a small number of duplicate entries exist, you can delete those invalid manually by right-clicking on the invalid entry, and then clicking Delete .

    For large double-number of entries in your library (or if all your library is duplicated), it might be better to create a new library and delete the files.

    Method 2:

    After you remove the duplicate entries, run the troubleshooting of Windows Media Library settings to solve this problem.

    Open the troubleshooter in Windows Media Library

    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-library-Troubleshooter

    Let us know the results.

    I hope this helps.

  • Creating shadows, but having problems.

    I have been using After Effects for a year in and out, so I'm pretty new. I worked on a tutorial the other day that shows how shadows. I got everything to work except the 'virtual' floor in the shadow of my text on is having a problem. I want to take the floor to be transparent but still accept the shadow. The tutorial says that if you disable the transfer mode to "multiply", it would become transparent. For them he did... for me it becomes transparent semi shade looks great, but I want the rest of the layer to be visible... All thoughts. I'm runing CS 5

    Make sure that the layer is perfectly white outside the shadow areas. If necessary, before dialing and roll back the white and black with a levels adjustment or curved points...

    Mylenium

  • Need to transfer my mail from windows mail on vista to windows live mail on windows 7 - but having problems

    I know there are a lot of similar problems on this forum but no one has mentioned a problem in the transfer of mail on a hard drive. I completed the following steps:

    -Mail exported from Windows Mail on my computer vista laptop to a folder on the desktop

    -A tried to save this folder on an external hard drive in order to import messages in Windows Live Mail on my new laptop Windows7.

    Copying starts without a problem, but coming up with an error message telling me that the files will be copied without their properties. I can then choose to continue without properties or to cancel the process.

    It is for as much as I got - emails are extremely important related to the work of the conversations and I desperately need to transfer! My old laptop is on its last breath and I would like the peace of mind of having saved emails before he dies on me!

    Thank you very much in advance for your help

    Chloe

    Hi - Thanks a lot for this suggestion. I have now managed to cross the emails. I continue when I got the message and it worked - I think that this has been facilitated by uncheck the 'read only' box in the properties of emails before copying.

    Thank you so much for all help.

    Chloe

  • Firefox keeps blocking Java plugins, I've updated several times, but the problem persists "VLC media player Web Plugin 2.1.3" update now don't workr

    I've updated the VLC media player a dozen times in the last week or two, but it continues to not work, with a message from Firefox to come saying "Web PluginVLC Web Plugin 2.1.3 vulnerable 2.1.3.0 VLC media player update now". All other plugins seem to now, Firefox said recently that many of them had recently updated and all the others worked.
    Almost all the websites that I visit comes up with a message saying that the plugin is obsolete and has been blocked and I think maybe I should just give up Firefox and use another browser.

    Yes, it would be wise to delete this program VLC.

  • My laboratory of construction but having problems

    Hello

    I wonder if anyone can help me please?

    with in my production environment, I created a VM and installed ESXi in this virtual machine with the IP 10.1.1.37/24. From the Esxi (this new virtual machine), I can ping the gateway (.1) DNS etc.

    I only build three virtual machines with this ESXi.

    It is:

    I assigned IP 10.1.1.100/24 for this new machine virtual but unable to reach the front door (. 1).

    If I changed the door of 10.1.1.37 (I can only ping to a.37)

    Could someone please advise how can I join le.1 GW?

    Thank you very much

    S

    Brand safe mode "Promiscuous" and forged passes to Accept value in your physical host, see how: http://www.vladan.fr/nested-esxi-6-in-a-lab/

  • seems I'm not the only one having problems with safari after update 9.3 cannot follow the links. Safari blocks. hope it gets fixed quickly. jaa shooting allows to follow the link, but the Web page is not out of good old days. any oher ideas?

    seems I'm not the only one having problems with safari after update 9.3 cannot follow the links. Safari blocks. hope it gets fixed quickly. jaa shooting allows to follow the link, but the Web page is not out of good old days. any oher ideas?

    The 'list' of relevant articles that I know, they are now

    -You can read about the problems in the present statutes and possibly find workaround solutions, particularly in the last

    If you are unable to activate your iPhone, iPad or iPod touch after installing an update - Apple Support

    Apple iOS suspension 9.3 updates for older devices, work on activation fix | IVous

    Apple launches new version of iOS for iPad users 9.3 2 affected by bricking bug | 9to5Mac

    GSM of unfixed addresses Apple iPad 2 Bug with revised Activation iOS 9.3, but the larger question remains - Mac rumors

    If you are unable to activate your iPad 2 (GSM model) update to iOS 9.3 - Apple Support

    9.3 iOS update issues

    Leave a post by: ChitlinsCC

  • The sign '+' opens NEW TAB stopped working. I have to open a new window each time. I tried to uninstall firefox and install again but the problem persists. Someone guide me on this.

    The sign '+' opens NEW TAB stopped working suddenly. I have to open a new window each time. I tried to uninstall firefox and install again but the problem persists. Someone guide me on this.

    Your agent uisr string is "Mozilla/5.0 (Windows;" U; Windows NT 5.1; en-US; (RV:1.9.2.15) gecko/20110303 AskTbMPC2/3.11.0.15286 Firefox/3.6.15 ', the part of AskTbMPC2 shows you have the toolbar installed Ask. Some third-party programs will add the Ask toolbar.

  • I created a photo album on my iMac with 241 photos but my iPhone shows that 220 photos. I deleted the album and created a second time but got the same result.

    Hi - I created a photo album on my iMac with 241 photos in it, but my iPhone shows that 220 photos from the same album. I've deleted the album and created a second time, but got the same result, only 220 photos appear. I 2.9 GB available in iCloud, so it can't be the issue.

    Al

    Try the settings/iCloud and remove the synchronization. Wait a few minutes and then resynchronize.

    Have you tried the signature to iCloud and then reconnect?

  • Is anyone having problems with the Times and the Sunday Times App

    Im having problems loading from the Times and the Sunday Times app. Before I launch into a major description (I have Parkinson's disease, and typing is slow) is there a known issue with the application at the present time

    There has been a lot of problems with this app as soon as they have a clear, the other seems to appear.    Take a look at this link and it followed in areas where you are affected by.

    http://www.thesundaytimes.co.UK/Sto/multimedia/archive/00258/Helpguide_stripped _ _258975a.pdf

  • Send an email using mail my signature seems to drop before my email is considered by my beneficiaries. This does not happen all the time but often. Is anyone else know / encountered this problem? If, kind of help to rectify this please.

    Hi, when you send an email using the mail my signature seems to drop before my email is considered by my beneficiaries. This does not happen all the time but often. Is anyone else know / encountered this problem? If so help to rectify this would be greatly appreciated please. Thank you

    It is up to the recipient how their e-mail is displayed. For example, if you include html or an image in your email the recipient may set up their customer e-mail to not display html or images. You have no control over the way a recipient chooses configure their e-mail client.

  • I'm trying to download the updates to my computer, but can't. I get the error code 646 and the download fails. I tried to download the update several times, but get the same answer. What is the problem?

    Ideas: I'm trying to download the updates to my computer, but can't. I get the error code 646 and the download fails. I tried to download the update several times, but get the same answer. What is the problem?

    • Pragrams you have problems with
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Hello

    Try this 1st to see if it helps, and it should:

    Description of the Patch registration cleanup tool
    http://support.Microsoft.com/kb/976220/

    ------------------------------------------------------

    If necessary :

    Try this - Panel - Windows Updates - on every update that will not be installed - click on the important updates
    or the update itself - double click a view more information (or click top then discovers on the right)

    Those who will take you to a page where you can download the update.

    Or go here and the KBxxxxxx number to download it.

    Download Center - mount the KBxxxxxx.

    Microsoft Download Center
    http://www.Microsoft.com/downloads/en/default.aspx

    Download - SAVE - go to where you put them - click on - RUN AS ADMIN

    Then you can right click on the update in the updates Windows and HIDE.

    If you get an error Installer install this version:

    Windows install 4.5 Redistributable
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en

    ----------------------------------------------------

    Then run this:

    How to reset the Windows Update components? -a Mr Fixit
    http://support.Microsoft.com/kb/971058

    Description of the system for Windows Vista, Windows Server 2008, update tool and
    for Windows 7
    http://support.Microsoft.com/kb/947821

    ------------------------------------------------------------
    Because these are all Office updates you might get more information if necessary in the Agency of those groups that
    may have experienced the same problem.

    Office newsgroups
    http://www.Microsoft.com/Office/Community/en-us/FlyoutOverview.mspx

    Microsoft.public.office.misc discussions
    http://www.Microsoft.com/communities/newsgroups/list/en-us/default.aspx?DG=Microsoft.public.Office.misc&cat=en_us_01cb749f-c998-4762-8099-df71793c11c7&lang=en&CR=us

    ------------------------------------------------------------

    If necessary you can incident free get reports however the above should take care of it for you.

    Windows updates - free Incident report

    Go here and click on-> Windows Update fails while searching, downloading or installation of updates
    http://support.Microsoft.com/GP/wusupport#tab3

    The security updates, you can get free support Incident report
    http://www.Microsoft.com/protect/resources/support.aspx

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • Go off & on several times before the monitor turns on. Comp seems to start OK but the problem is with the screen.

    Original title: XP start help please...

    ... are to be turned off & on several times before monitor lights. Comp seems to start OK but the problem is with the screen. Do I have to make a boot disk & if so - HOW?

    Hello

    ·         What is the brand and model of the computer?

    ·         You get the error message?

    ·         Did you check the connection of the cable to the monitor?

    ·         Have you tried to update to the latest graphics card and motherboard chipset drivers?

    First, try to connect your monitor to a well known PC, maybe the old laptop that you use now. If the monitor works, the problem is with the video card in your PC. If the monitor does not light, the monitor. It is usually cheaper to buy a new monitor that in order to be an old repaired, unless the monitor is still under warranty.

    Try connecting a monitor well known to your PC. If the monitor works, your old monitor is fried and needs to be replaced.

    If your monitor works when connected to another PC, the problem could be your video card. First, and then you turn on your PC, the power and cooling case fans run they. If they do not, it could be the power supply.

    Then, open the computer case. Before you do anything inside, unplug the power supply.

    IMPORTANT! Touch any metal part of the computer case to connect to the PC. A single static spark can destroy computer circuits.

    If the video card is the type of card that plugs into a slot on the motherboard, remove the screws or attached at the top of the card, remove the card, to manipulate the card by the edges to avoid disturbing the circuits on the card, carefully and re - install the card. Sometimes simply reinstalling the card corrects the problem.

    If this does not work, replace the video card with a card of similar type. Perhaps now is the right time for an update of video card.

    If the video card is integrated into the motherboard, you can install a new card in one of the PCI slots on the motherboard. When the PC starts for the first time, go into the bios and disable the onboard video.

    Resources for troubleshooting problems in Windows XP

    http://support.Microsoft.com/kb/307960

  • Hello. I purchased a CS2 product and im having problems with activation. I have the key but my installation failed in the 'summary '. Please help thanks.

    Hello. I purchased a CS2 product and im having problems with activation. I have the key but my installation failed in the 'summary '. Please help thanks. This is what im seeing.

    Screen Shot 2016-03-01 at 9.09.51 PM.png

    See my response in audition 3 error with installation

  • Ive been having problems with my Lightroom 6 (desktop only version - version installation CD), so I uninstalled. But now I can not re - install. Help, please.

    Ive been having problems with my Lightroom 6 (desktop only version - version installation CD), so I uninstalled. But now I can not re - install. Help, please.

    It seems that you try to install the version of Windows on your Mac, that will not work.

    I haven't used a DVD for installation of Age, but I would have thought that the Mac version would also be on the disk.

    I'm not a Mac person, but I think that the executable file would have the .dmg extension.

    Or you can download the latest version - 6.4 Lightroom - from here: keeping up-to-date for Lightroom

    I hope it works better the other link you tried.

Maybe you are looking for