Flash Game Score not working AS3, please help?

So Im creating a game and all I wanted to add was a counter that increments constantly until a player loses the game.
I created my score class and it looks like this:
package
    import flash.display.MovieClip;
    import flash.display.Stage;
    import flash.text.TextField;
    import flash.events.Event;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    public class Score extends MovieClip
        public var second:Number = 0;
        public var timer:Timer = new Timer(10);
        private var stageRef:Stage;
        public function Score(stageRef:Stage)
            x = 537.95;
            y = 31.35;
            this.stageRef = stageRef;
            timer.addEventListener(TimerEvent.TIMER, clock);
            timer.start();
        function clock(evt:TimerEvent):void
            second += 1;
            scoreDisplay.text = String("Score: " +second);
and this is my engine class that adds it to the stage:
package  {
//list of our imports these are classes we need in order to
//run our application.
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
public class Engine extends MovieClip{
    private var enemyList:Array = new Array();
    private var ourBoat:Boat;
    private var score:Score;
    public function Engine() : void{
        //create an object of our ship from the Ship class
        ourBoat = new Boat(stage);
        score = new Score(stage);
        //add it to the display list
        stage.addChild(ourBoat);
        stage.addChild(score);
So that creates a timer on the stage and continuously increments, but when I compile, I get no errors and my timmer for some reason doesn't work, it just displays random numbers, please help! If there is a better way of doing this please enlighten me.

When I said it continuosly increments, I meant thats the function I was looking to do. The file compiles fine with no errors, but when you look at the textbox where im displaying the timer it flickers strangely and shows random numbers as if its crashed or that its not working properly just a load of 1's and 0's. I even tried changing the miliseconds to 1000ms it still does the same thing.

Similar Messages

  • Hi Guys,  I am using the full width video widget on a site. The widget was working perfectly however I have just added additional content to the site and re-uploaded and now the video is not working! Please help I have tried everything and am freaking out

    Hi Guys,
    I am using the full width video widget on a site. The widget was working perfectly however I have just added additional content to the site and re-uploaded and now the video is not working! Please help I have tried everything and am freaking out as this web-site has been payed for by my client.
    Alex

    Many thanks.
    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • I've just updated my iPhone to the new iPhone OS and now it won't work and iTunes won't recognise that it's there.  I've uninstalled iTunes and reinstalled twice and it's not working.  Please help.

    I've just updated my iPhone to the new iPhone OS and now it won't work and iTunes won't recognise that it's there.  I've uninstalled iTunes and reinstalled twice and it's not working.  Please help.

    I have not had wifi since November when I upgraded to the newest IOS version.  I called the Apple help line and they told me some things to do and I tried them all and they worked for a few hours and then wifi shut off again.  I kept doing what they told me and it worked for a couple more days and then I could never turn it on again.  My blue tooth doesn't work either.  I had to actually increase my data usage with AT&T becuase of this.  When I did that in December I went to the Apple store and was told that it is a hardware issue and since my phone is out of warranty I would have to pay for a new phone because they could not fix the issue.  My upgrade isn't up until June 2014 so not only do I have to wait for the upgrade and I am not paying for a new phone but I have to pay $10 plus extra a month on my cell phone bill because I was going over on my Data!!!  I have been beyond upset about this and Apple is not doing anything about this nor did they offer up some way to resolve the issue because obviously it is not just some rare incident if several people are having this issue.  Who knows how many people out there have had this issue and have not said anything about it.  Now there is a newer update that I can't do because it requires wifi in order to download.
    June can not get here fast enough and I may not go back to Iphone after dealing with this for so long with no help from Apple.

  • Ever since the last IOS update, my Iphone 5c has been acting weird. The time is always off; It says that its 9:30 in the morning when it's actually 2pm. I try to fix it, but it just goes back to not working. Please help!!

    I go to settings and switch "Automatic time" off and then back on. It works for a while, but then just goes back to being off. I've tried manually setting the time, but it just goes back to what it was before. If I send a text, it sends and then disapears. I can't see what I wrote! I went in to Apple to try and get it fixed, but they just restored my phone. It's still not working. Please help!

    It's not hacker or a virus. You are experiencing what a number of users of iOS 5 are experiencing now - sluggish or less than perfect iPad performance. It seems that for some of us - memory management has gotten a little out of whack with this most recent update. Some of the basic troubleshooting steps that you can try are ....
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Close apps in the recents tray. Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    If you have Safari crashing issues - Go to Settings>Safari>Clear History, Cookies and Data. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    None of these steps should be necessary as part of your daily routine - the iOS is supposed to handle all of this without any user input. Once again - for some of us - the iOS is letting us down.
    Until Apple releases another update that resolves this issue for the "few" that suffer, keep these steps in mind and use them as needed.

  • HT3887 my bluetooth says 'Not Available' how do i get it to work again. I have restarted the computer several times and have replaced the batteries in both the keyboard and mouse and yet it still is not working! please help

    my bluetooth says 'Not Available' how do i get it to work again. I have restarted the computer several times and have replaced the batteries in both the keyboard and mouse and yet it still is not working! please help

    I have had the same problem. It was cured by turning computer off and/or restarting it. I am not sure  if once was enough. I think shutting down must cut out whatever it is that blocks bluetooth. Good luck

  • After installing iPhone Configutilities in my Mac, Personal Hotspot using USB is not working! Please help, I am using 10.7 Lion OS

    After installing iPhone Configutilities in my Mac, Personal Hotspot using USB is not working! Please help, I am using 10.7 Lion OS

    Did you talk to your carrier?

  • I have iphone 4s and just bought an ebook for ibook, trouble is the font is so tiny I can't read it and the font sizer is not working? Please help!

    Hi, I have the  iphone 4s and just bought an ebook for ibook, trouble is the font is so tiny I can't read it and the font sizer is not working? Please help!

    Hello Glittergirl68,
    Thank you for using Apple Support Communities.
    It sounds like the function to reseize the Font in an iBook is not functioning properly.
    I recommend a few things here. First close all the apps that are running in the background:
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app up to close it.
    From: iOS: Force an app to close
              http://support.apple.com/kb/ht5137
    When you have done that, restart the phone, and try again.
    If the issue persists, I would follow these steps from the article:
    iOS: Troubleshooting apps purchased from the App Store
    http://support.apple.com/kb/TS1702
    2. Check for app updates
    You can setup apps to update automatically in Settings > iTunes & App Store, but make sure that your apps are up to date:
    Open the App Store and tap Updates. If updates are available, tap Update All.
    If  prompted, enter your iTunes Store account information. App Store will then download and install the app updates.
    Note: Some apps may require a Wi-Fi connection to update.
    3. Install another app from the App Store
    If none of your user-installed apps will launch, there could be an issue with Apple ID authorization. Download and install an app that isn't already installed on your device to reset this information. You can also remove an app from your iOS device and download it again from the App Store or sync the app from your computer.Note: If you have installed apps using multiple Apple ID accounts, you may need to perform this step for each account.
    4. Restart the app
    If the issue affects only a single app, try closing just that app.
    5. Restart your device
    Turn the device off and on.
    6. Reinstall the affected app
    Remove the app from your device and reinstall it:
    Tap and hold any app icon on the Home Screen until the icons start to wiggle and show a small "x" in the top-right corner of the app.
    Tap the "x" in the corner of the app you want to delete.
    Tap Delete to remove the app and all of its data from your device.
    Press the Home button.
    Go to the App Store.
    Search for the app and then download it again.
    All the very best,
    Sterling

  • I have purchased Production Premium CS4 Educational Version. Its serial number is not working. Please help...

    I have purchased Production Premium CS4 Educational Version. Its serial number is not working. Please help...

    If you recently purchased this then it is not likely to be a valid sale/purchase.  Adobe does not sell older versions of their products and no one but Adobe provides student/teacher licensing.  If you purchased this some time years ago and it is only recently that you find you are not able to reactivate it with the original serial number you can try contacting Adobe Support thru chat and see if they will be willing to work with you to resolve this.
    For the link below click the Still Need Help? option in the blue area at the bottom and choose the chat option...
    Serial number and activation chat support (non-CC)
    http://helpx.adobe.com/x-productkb/global/service1.html ( http://adobe.ly/1aYjbSC )

  • Brand new Mac user help please! How do you connect a 17" monitor to the MacBook? I have the monitor plugged into the Mac, but the F8 that I am used to with PC does not work. Please help. Thanks.

    Brand new Mac user help please! How do you connect a 17" monitor to the MacBook? I have the monitor plugged into the Mac, but the F8 that I am used to with PC does not work. Please help. I am getting lots of spelling errors as the MacBook laptop screen is too small. Thank you so much! .

    Contentmom6 wrote:
    Brand new Mac user help please! How do you connect a 17" monitor to the MacBook? I have the monitor plugged into the Mac, but the F8 that I am used to with PC does not work.
    Normally, you just connect the monitor to the MacBook using a VGA adaptor that you can buy from an Apple Store.  Now try System Preferences > Displays > Detect Displays.  You should now be able to select a display mode for the monitor.  If it still doesn't work, then I'd check that everything is properly connected.  I've had problems with colours disappearing due to a faulty connection in the VGA adaptor.
    Bob

  • I just got the iPhone 5 and noticed that the message alerts will only alert once . I have it set up as 3 times and its not working . Please help. I'm running 6.0.2 and I really starting to get ****** off with apple products

    I just got the iPhone 5 and noticed that the message alerts will only alert once . I have it set up as 3 times and its not working . Please help. I'm running 6.0.2 and I really starting to get ****** off with apple products

    Instead of getting annoyed, read the User's Guide and try basic troubleshooting.

  • I have a 4s with ios 6 but when I place a call I can't hear the person I' m calling, the volume is high but it's not working. Please help.

    I have a 4s with ios 6 but when I place a call I can't hear the person I' m calling, the volume is high but it's not working. Please help.

    I have taken it back to the Apple store genius bar, but they say they don't see anything wrong. Well unless you use it all day and experience the problems when they happen, you wont see anything wrong. But there are lots wrong with it. But this would be the same store as I purchased the phone. And they backed up my old Iphone 4, but were not able to get anything to load back onto my new phone. So, I lost pretty much everything. But over time, some of my contacts have started showing up, although i am still missing over 800 of them.

  • HT204387 I have brought a iPhone 5s and installed software but my bluetooth is not working. Please help me

    I have brought a iPhone 5s and installed software but my bluetooth is not working. Please help me

    What are you trying to connect the iPhone to and what is happening when you try?

  • My iPod touch Nike ipod sensor is not working. Please help.

    My iPod touch Nike ipod sensor is not working. Please help. I even walked around when it asked me to. Also I have latest version of iOS. PLease help

    Update: I seem to have fixed the problem!  I went to the "summary" section of my iPod after clicking on the device on the left side of iTunes.  I checked the box that allowed me to "manually manage music and videos" and applied this option.  The songs are syncing!  And, yay, they're playing on my iPod now!  Hopefully, this helps anyone else who might have this problem.  There might be other issues, but this is working for now.

  • My phone is not making calls or sending text it keeps saying it is searching in left hand corner! I've read and tried to restart and reset and its not working! Please help

    My phone was working fine this am then I go to use it and there is a searching word in the left corner and I can not send a text or a call, i read what the online said to do and it did not work! Please help!

    The searching is searching for your cell phone providor... without that being connect you will not be able to use your phone or text messages... try turning on Airplane mode for 30 seconds and turning it back off to see if it reboots the providor search.

  • I have a Excel file which has lots of PDFs embed as a link.  When i converting to PDF the embed links are not working. Please help to slove this issue.

    I have a Excel file which has lots of PDFs embed as a link.  When i converting to PDF the embed links are not working. Please help to slove this issue.e

    I am also looking alternative way using inDesign to create the embed link as like as excel. is there any possible? Thanks for you reply

Maybe you are looking for

  • How can I get alerted when someone replies to my comment?

    I would really like to get a notification when someone replies to my comment in the forums. I have set my preferences to get email notifications for things I'm following but I get notifications for every time someone writes something in the forums. (

  • To read data from tape

    Hi All, can we read the data file or data from the tape ( magnetic tape) If yes then How? Thanks Neeraj

  • Printing a picture

    Have an OfficeJet 4620 and I want to print a photo stored on Picasa onto 4x6 photo card.  How do I do this ?

  • Format help

    Hi, I'm trying to program a small application that scans, calculates and displays date, also to display only 7 numbers and a alphapet is there any way to do it?

  • HT3748 for some reason i can not send mail only receive it on hotmail

    For some unknown reason i can only recieve mail and not send it on hotmail, it has worked perfectly before.