Score appears as NaN

OK, so I had put in place 'rating' in my game, but could never figure out how to reset the score or save a best score. I understand now how to reset the partition failure, but I can't get this code works for the recording of the score.

frame 1 I have (among other things)

object shared to be remembered of score
sharedObject varharedObject;
sharedObject = SharedObject.getLocal ("LRScores");

var score: Number = 0;

var myFont = new Font1();
format text
var textFormat:TextFormat = new TextFormat();
textFormat.size = 180;
textFormat.color = 0xb60303;
textFormat.font = myFont.fontName;
var textFormat2:TextFormat = new TextFormat();
textFormat2.size = 75;
textFormat2.color = 0xb60388;
textFormat2.font = myFont.fontName;
end of formatting start adding text box1
var textfield:TextField = new TextField();
textfield.autoSize = TextFieldAutoSize.LEFT;
textfield.defaultTextFormat = textFormat;
textfield.embedFonts = true;
textfield.antiAliasType = AntiAliasType.ADVANCED;
TextField.Text = '0 '.
TextField.x = - 640;
TextField.y = - 1050;
addChild (textfield);

start adding the BEST score textbox
var bestScore:TextField = new TextField();
bestScore.autoSize = TextFieldAutoSize.LEFT;
bestScore.defaultTextFormat = textFormat2;
bestScore.embedFonts = true;
bestScore.antiAliasType = AntiAliasType.ADVANCED;
bestScore.text = '0 '.
bestScore.x = - 640;
bestScore.y =-910;
addChild (bestScore);

like you, the "progress" through the game, the points are added to the score
If you "fail" points are supposed to be reached and compared to the "bestScore."
If bestScore has not been set, the game is supposed to define.
If the current score is BETTER than bestScore, it will replace bestScore.
If not, it won't.

It's the actionscript on the frame of "failure".

addEventListener (Event.ENTER_FRAME, setFinalScore);
function setFinalScore(score:Number):void
{
TextField.Text = score.toString ();
VR;
{
If (sharedObject.data.bestScore is nothing)
{
sharedObject.data.bestScore = result;
}
Else if (score > sharedObject.data.bestScore)
{
sharedObject.data.bestScore = result;
}
bestScore.text = sharedObject.data.bestScore.toString ();
sharedObject.flush ();
}
catch (sharedObjectError:Error)
{
trace ("caught this error:", sharedObjectError.name, sharedObjectError.message);
}
}

When I test my game I get no errors in the output window. It rolls
However, when I have "fail" instead of setting the best score, the two areas of text read NaN instead

can IM tearing my hair out here... anyone help me?

Sweet it works!

I left frame 1 of the way in which I mentioned in the last post.

the framework of failure now reads

addEventListener(Event.ENTER_FRAME, setFinalScore);
function setFinalScore(event:Event):void
{
    if ( sharedObject.data.bestScore == null )
        {
            sharedObject.data.bestScore = score;
        }
        else if ( score > sharedObject.data.bestScore )
        {
            sharedObject.data.bestScore = score;
            bestScore.text =       sharedObject.data.bestScore.toString();
            sharedObject.flush();
        }

    }

the great thing is now run the function on each image, it updates bestScore real-time... it's great!

Thanks again

Tags: BlackBerry Developers

Similar Questions

  • Partition not appearing is not in the main drive.

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

    Ideas: I partitioned a 1 terabyte of hard drive and when I use the primary drive it only shows the partitioned drive. If I boot with the other drive in 32-bit mode, it shows all the drives in my computer including partitioned drive. Have you tried many solutions online and nothing solves this.

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

    Hello

    ·        What is the operating system installed on the primary drive?

    ·        The score appears in disk management?

    ·        Did you manually any drive letter assigned to the partition?

    You can check the links given below and check to see if they help.

    http://Windows.Microsoft.com/en-us/Windows7/managing-hard-disks-recommended-links

    http://Windows.Microsoft.com/en-us/Windows7/change-add-or-remove-a-drive-letter

    http://Windows.Microsoft.com/en-us/Windows7/can-I-REPARTITION-my-hard-disk

    Hope this information is useful.

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Cannot read queue measurement - what is happening?

    Hi-

    I have problems reading data from a file of measures. 28 signals are merged and saved to a file text LVM. When this file is loaded into the program, all values appear as NaN. I looked at the properties of the File.VI of Measuement of reading and reading of the values, but there are other things mixed in there too - hour, day, things like that. Basically, I want to record a signal and to reproduce exactly later, the. Can I get help?

    Thanks in advance for any help.


  • Running out of disk space on RECOVERY D

    I have a Dell Inspiron 3647, which comes from the factory with Windows 7 installed. When 10 windows came out and was free, I've upgraded to Windows 10. After many problems of compatibility with my old programs, I decided to downgrade to Windows 7. It is more than 30 days, so can not return automatically to Windows 7. I had the Windows 7 installation disc and the drivers, so I did a clean install and re-installed Windows 7. After installing Windows 7, I got a message that says:

    "You run lack of disk space on RECOVERY D."

    Two things, I would like to know. What is the "RECOVERY D" partition used for? And how do I get rid of the message "you run lack of disk space on RECOVERY D?

    Any suggestion is appreciated.

    dino80

    You have upgraded to Windows 10 then manually installed Windows 7. The recovery partition now will no longer work. The score appears in Windows Explorer after a manual install but on a good factory install its hidden.

    Perform a clean installation correct using Diskpart clean everything before loading Windows 7.

  • then I just remove my hard drive without crashing the system

    I just back up files on the HARD drive. There is no system files or programs on it. Can I remove and replace it with a bigger memory HARD drive, without crash the system?

    Yes, you can remove the HARD drive without crashing the system by closing the PC, unplug the power supply from the socket and then remove the HARD drive.

    Please note that the physical HARD disk is different from scores.

    Hard physical HARD drive or disk drive is the hardware component for storage. The capacity varies.

    A HARD disk cannot be used directly when it is connected to a computer, that's why storage units with file tailored to the needs of the system to create, known as partitions.

    A partition can be a complete HDD (for example, if you have a physical HARD disk and you have only one partition C:\) or may be more than one partition of a physical HARD disk (for example, if you have a HARD physical disk and two or more than two partitions, such as C:\ and D:\).

    Therefore, you can check for the exact physical HDD and then remove it. To do this, you can go to the computer-> storage management. Check the link for more information:

    http://www.7tutorials.com/how-manage-your-disks-using-disk-management-utility

    This will show you the number of physical drives present in your PC and the partitions present in each HARD drive. So, once you confirm the HDD backup and partition (make sure that there no Windows installation, as says iFuton), you can shut down the PC, unplug the power supply and then remove the HARD drive.

    [Please note that you have nothing to do in the management of the computer, except to check the partitions and hard drives (denoted as disk 0 disk 1 and so on for disks hard physical as well as the corresponding scores appear accordingly)]

  • currentTarget is undefined

    HI I am trying to play a game, and when you click with the mouse on a given target, it's supposed to assign the currentTarget corresponding to a number that represents the clip you clicked, but it does not work, the number appears as "NaN" not a number. Anyone know what I'm doing wrong? Thanks, here's the function that I have a problem with:

    public void clickBeast(event:MouseEvent) {}

    / / avoid the mouse clicks while showing the sequence

    if (gameMode! = "replay") return;

    var thisBeast:String;

    var value1:Number = repeatOrder.shift ();

    if(value1 == 0) {}

    thisBeast = "Cat1";

    { } ElseIf ((value1 == 1) |) (value1 == 2) | (value1 == 3) | (value1 is 4)) {

    thisBeast = "Dog1";

    { } ElseIf ((value1 == 5) |) (value1 == 6) | (value1 is 7)) {

    thisBeast = "Cat2";

    { } ElseIf ((value1 == 8) |) (value1 is 9)) {

    thisBeast = '2 ';

    { } else if(value1 == 10) {}

    thisBeast = 'Cat3 ';

    }

    trace (thisBeast);

    var thisBeast2:String;

    var value2:Number = event.currentTarget.beastNum;

    if(value2 == 0) {}

    thisBeast2 = "Cat1";

    { } ElseIf ((value2 == 1) |) (value2 == 2) | (value2 == 3) | (value2 is 4)) {

    thisBeast2 = "Dog1";

    { } ElseIf ((value2 == 5) |) (value2 == 6) | (value2 is 7)) {

    thisBeast2 = "Cat2";

    { } ElseIf ((value2 == 8) |) (value2 is 9)) {

    thisBeast2 = '2 ';

    { } else if(value2 == 10) {}

    thisBeast2 = 'Cat3 ';

    }

    trace (value2);

    trace (thisBeast2);

    / / OK game

    if (thisBeast2 == thisBeast) {}

    beastOn (event.currentTarget.beastNum);

    / / checks if the sequence is completed

    if (repeatOrder.length == 0) {}

    nextTurn();

    }

    / / got it wrong

    } else {

    textMessage.text = "game on!"

    gameMode = "gameover";

    }

    }

    You cannot process an interactive object as a number, and I don't see where the code you have tried that.  If you talk about the property beastNum that you are trying to use, it could be a case of how you define / set this value.  You need to explain this.

    For the first lines in that function set...

    trace (Event.currentTarget);

    trace (Event.currentTarget.beastNum);

    For the first line, it must copy the object that was involved in the event.  What is produced by the second line?

  • New messages appear in the Inbox already reported. CLR can't score with SHIFT + L

    Most read msgs in Inbox all becomes marked. SHIFT + L does not clear the flag. All new email messages arrive with the indicator is defined. Same condition occurs when you are using another computer that works under XP. Don't know if I did anything because of this situation.

    It seems that I misunderstood the terms I see in Yahoo. Please ignore my problem report and consider that it erased. I'll try to do my own research to better understand what I see. If I still have problems, I will enter a new problem. Thanks for your help and sorry for wasting your time.
    John P

  • Score editor {} why a musical note appears more than once when the key was pressed only once? (Image)

    Thus, for example, ringed RED notes are not affected at this time there, then why they arise after the GREEN circled notes, which are affected. It has to do with the length of the MIDI note or sustain? (I have the pedal which is held for the entirety of the song)

    Note, I'm seriously new whereupon on sheets of music, so I apologize if it's both obvious and a very simple solution. Thanks for the help!

    This has to do with the length of the midi note. Make sure you play on a click track (turn on the metronome) and slow down a little if necessary (tempo).

    Also turn on syncopation to eliminate some of the links and according to your needs... set the quantize to a lower value for example display 8.  You define quantize for the smallest value you want to play (if its 8th note - 8, then black - 4 then - sixteenth note 16 etc.).

  • I deleted WIndows 8 for the score, but his name appears in the display to dual boot

    I used Windows XP and Windows 8 for some time. I felt that I should remove Windows 8.je went to disk management and has deleted this partition and created a new partition. I also installed a new Windows 7 in this new partition. But the problem is that when I turn on the PC, the dual-boot screen. But it also seems the name of Windows 8 with Windows 7 and earlier version of the window.
    I don't know why the name of Windows 8 is despite him being withdrawn.

    In addition to the information given by Liz above, Windows 8 is not listed in the boot.ini for Xp and Windows 7 does not use a boot.ini file. The best way to solve this problem is to start in Windows 7, then use EasyBCD to modify the boot options delete Windows 8.

  • Quiz results slide - NaN errors in published Captivate 8 content

    Hello

    I worked on a number of modules with different content in each, which have a short quiz at the end. All except a beautiful work and the quiz results slide displayed correctly the 'score' and 'max' accordingly.

    However, I have a module with an erroneous result reported "0" out of "NaN" and I don't know why it appeared suddenly?

    I have been a model for these modules (even if it is true that it has been outsourced - they should always use the same model)

    I don't see any obvious difference in the parameters or results between this slide and the other modules - so I'm stuck!

    I was wondering if something had gone wrong with the slide therefore results as a test, I copied all the slides except the quiz in a separate model that has worked very well, and then updated the quiz and slides re-edited, still had the same error. This leads me to suspect the content slides are part of the problem. There are some real questions in the content slides / false, which are defined as a "pre-test" type - could these affect something?

    I am using Captivate 8.0.3.290 and I checked the result published scorm cloud and our Moodle LMS - same erroneous result.

    I hope someone can help?

    Thank you

    Jon

    It is difficult to know what is the problem with this model. I highly doubt that the presence of pre-test slides is the cause. It is perfectly possible to have a pre-test and a Final Quiz in a project. To exclude this possibility: try to create a small project with a test question and a real Question slide, using this same model.  Follow the system variable. What is the result?

    You know if this model was created initially to CP8 or is this a version update of a model?

    I never delete the review area, although it is used in two circumstances:

    1. For the message of pass/fail on the Score slide
    2. When a question has been ignored (I always feel that issues are considered to be ignored).
  • Where is an insertion mark in a game Score?

    Hi all

    In my note, I have 8 percussion in the arrange window. Later, I added a new instrument/track. To add a new instrument for a Score to set the manual recommends:

    Do one of the following:

    Set the insertion mark where you want to add a tool, then choose new > add an instrument.

    Where this insertion mark to show where to put, please? I select an instrument under which I want to introduce a new drum but after clicking Add Instrument input, the new inst appear on a button of the partition.

    Thanks in advance


    X there is no insertion mark. Adding a new instrument in through the drop down insert the next instrument as defined by the order of the tracks in the arrange window. What you do are framed an instrument, then right-click on it - and reassign the instrument you want. To change the order after all instruments have been added to the whole score - highlight the one you want to go - hit control c, the highest point, one that you want to insert above and press Ctrl v

  • I can not conect to Sky Sports score centre was able to until this week, but can do it using ie

    Sky sports score centre does not load only a blank page

    Make sure that you do not block Flash.

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Tools > Options > advanced > network > storage (Cache) offline: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Tools > Options > privacy > Cookies: "show the Cookies".

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • Who's who and twitter stop working. NAN's Yearbook through what?

    I AI YOONO AND IT CONNECTS FACE BOOK and other sites for a reason that updates are marked NAN I'm not sure what it means. Twitter says my session has expired I try to reconnect yoono says it is connected but it is not.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • Clone of SSD will not appear at startup, but present in the startup disk

    OS X 10.11.3 El Capitan

    iMac (27-inch, late 2012)

    2.9 15

    32 GB of Ram

    My machine came with a standard 1 TB hard drive. I recently bought a PNY 960 GB SSD CS1000. and a USB to SATA adapter from Ebay.

    First of all, I cloned with the CCC. Then tried to use disk utility to see if that was the problem. Both have the same results.

    The cloning process was successful in both cases. It displays not only at boot time. I start my imac. Press the Option key and the new drive does not appear as a boot option. To make sure that its not only meet its time but never watch? After the starting of the machine. I go into the Preferences system-startup disk and performances as an option. I unlock a tell the machine to reboot using this disc. And it will restart, but still does not use the SSD.

    I did score as GUI and logged and followed all the relevant instructions. It seems fitting that at startup it find until after the start.

    Any ideas on what is happening. I want to be sure that it will boot from USB until I open my machine and install it as a replacement. Thank you

    Strange indeed. Looks like you've done everything right, but something does not play well. My first suspect is the USB-SATA Adapter, I do not trust any of the cheap knockoff sold on eBay. What happens if you clear and just install a new copy of El Capitan on the SSD instead of a clone? It will then start?

  • Vi return NaN mode

    I use the function to calculate the value of a table mode and it returns NaN. Help of LabVIEW says that she only returns NaN at the entry of the array is empty. I don't know why this is happening. My table is

    0,00015

    0.000114

    0.000146

    0.000188

    0.000139

    I tried with value mulitple of intervals.

    Thanks in advance.

    In this case, NaN means that no method has been found.  Look at it this way... you have a group of numbers and say to LabVIEW for break in 1000 separate "bins." If each tray has only 1 value in it, then there is no mode - no value that appears more often than other values.

    For all of your data, any number of intervals of < =="" 14="" will="" return="" a="" mode.=""  any=""> 15 returns NaN.

Maybe you are looking for

  • How to enable multi-user iPad support?

    The iPad seems to support multiple users (in educational mode), but I can't understand to add a second account.  Is it possible to implement the educational mode to access this feature? My wife and I use the iPad to a computer on the coffee table and

  • MBP 13 retina end 2013, no entry in the lock/lock screen

    I recently made a new installation of OSX El Capitan, and I started to notice that sometimes when I turn on the computer, it just stuck in the login screen, no keyboard or mouse input is present, it's weird, just the power button works, I can restart

  • Satellite 5100 503 - I need a new graphics card

    My 5100-503 Satellite picture shows scrambled during the start especially when the computer is hot.The sound breaks also. He was diagnosed as a problem of display card. The card has a chip from nVidia GeForce4 440 Go.What is the equivalent card avail

  • What is the error code 57 for update of windows vista 32-bit

    Whenever I try to do this update, it fails and gives me code error 57. What I'm doing and what it means? It is also a critical update.

  • DNS stops resolving ping IP address works

    Hello We run a Windows 2008 R2 domain functional and we have 3 Windows 2008 R2 domain controllers. Recently, we noticed a number of users on our network has a problem with their machine and we believe that the question is associated DNS. A user will