Not A number of loop problem

Hello
I have a table and a number of count (don't ask me to make a loop for, because it's already a loop in the fact she calls a function that calls!) to count and display text on the screen, but his does not.  It starts on (good) Up and then freezes, I created an output of the number and I get first freezes "Undefined" then "NaN" to the bottom. Can someone help me?
Thank you
S Connah
PS. Code here:

stop();

var score=0;
dave2.text = score;



function updateScore() {
    dave2.text = ++score;
    con.text=numtodo;
}
function reset() {
    var finalscore=dave2.text
    gotoAndPlay(1);
    score=0;
    finalscore=0;
    dave2.text = score;
    
    
}
function dotap() {
    var numtodo=1;
    thechase = new Array();
    thechase[1] = 1;
    thechase[2] = 3;
    thechase[3] = 2;
    thechase[4] = 4;
    var mySetting = 4;
    var myTemp=0;
    var totap = 0;
    totap = thechase[numtodo];
    var waittime = 1
    if (totap==1){
        dick2.text = "up";
        timerup = setInterval(checkup, 1000);
    }
    if (totap==2){
        dick2.text = "down";
        timerdown = setInterval(checkdown, 1000);
    }
    if (totap==3){
        dick2.text = "left";
        timerleft = setInterval(checkleft, 1000);
    }
    if (totap==4){
        dick2.text = "right";
        timerright = setInterval(checkright, 1000);
    }
    myTemp = totap;
}
function checkright() {
    if (Key.isDown(39)) {
        if(!Key.isDown(38)){
                    if(!Key.isDown(40)){
                                   if(!Key.isDown(37)){
                                       clearInterval(timerright);
         updateScore();
         numtodo=numtodo+1;
         dotap();
                       }}}
    } 
    if(!Key.isDown(39)){
        clearInterval(timerright);
        reset();
}
}
function checkleft() {
    if (Key.isDown(37)) {
        if(!Key.isDown(38)){
                    if(!Key.isDown(40)){
                                   if(!Key.isDown(39)){
                                     clearInterval(timerleft);
         updateScore();
          numtodo=numtodo+1;
         dotap();
                       }}}
    } 
    if(!Key.isDown(37)){
        clearInterval(timerleft);
        reset();
}
}
function checkup() {
    if (Key.isDown(38)) {
        if(!Key.isDown(40)){
                    if(!Key.isDown(37)){
                                   if(!Key.isDown(39)){
                                     clearInterval(timerup);  
                                     
         updateScore();
          numtodo=numtodo+1;
         dotap();
                       }}}
    } 
    if(!Key.isDown(38)){
        clearInterval(timerup);
        reset();
}
}
function checkdown() {
    if (Key.isDown(40)) {
        if(!Key.isDown(38)){
                    if(!Key.isDown(37)){
                                   if(!Key.isDown(39)){
         clearInterval(timerdown);                     
         updateScore();
          numtodo=numtodo+1;
         dotap();
                       }}}
    } 
    if(!Key.isDown(40)){
        clearInterval(timerdown);            
        reset();
}
}

dotap();

To what whether you try to expand, you have to learn how to use the function trace to your advantage.  The I've main goal is to help solve problems with the State of things.  It allows to see if a value of something is what you expect it to be.  For the code show you, I can guarantee you that at least a value will not...

You declare the numtodo value in the function dotap

function dotap() {}
var numtodo = 1;
...

}

Which gives it the scope only within this function, it is not available to do anything apart from this feature.

But in all the functions of the controls, you...

numtodo = numtodo + 1;

These functions cannot access numtodo.

Tags: Adobe Animate

Similar Questions

  • First iteration of a loop problem

    I'm having a problem with the first iteration of a while loop. I want to save all the data a data acquisition over a period of time. In order to keep the unique 'small' file, I'm doing a VI that produce a new file every 10 min. about. But the first file I want to do is not due to the following problem:

    The first time I use the DaqMX read in the loop, it returns a blank. Why does do that?

    I'm not entirely sure why, but I just set the number of samples to a specific value so that you do not need the function of Ms. wait 100 in the loop.

    Tone

  • Equium M50-244: loop problem internal ati2dvag.dll

    I had a M50-244 XP Home Edition (sp2) who have ATI onboard until I uninstalled it completely. The laptop has become totally useless vomit ati2dvag.dll inner loop problem and nothing seemed to heal so I decided to completely get rid of ATI.

    It started with VGASAVE which, with a few adjustments, work is fine and so my machine now. I disabled the video as controller he kept coming up with "new hardware found" and I didn't load the drivers more who would do what he started crashing again.

    Currently its on 'test' and I'm doing everything possible to see if it will crash once again, I hope not.

    Maybe I need another driver and activate the video controller, but I am hated for doing anything more now that his works normally, finally!

    Some said the installation of the graphics driver on the site omegadrivers.net and improves the performance of the graphics card.
    Maybe an installation of the driver from the site could be useful.

    Check it out

  • Why do write can not be performed because the number of data channels does not match number of channels in the task.

    Possible reasons:

    Scripture cannot be performed because the number of data channels does not match number of channels in the task.

    When writing, provide data for all channels in the task. You can also change the task so that it contains the same number of channels as the written data.

    Number of job channels: 8
    Number of data channels: 1

    Lama says:

    The DAQmx vi writing gives me the error. If I run a single channel, isn't a problem. Multichannel gives me error.

    You are funny! Why tie yourself to work VI (single channel) instead of one that gives you errors (multichannel)?

    (If your car does not work, you bring car your wives to the mechanic, right!)

    What is the exact text in the multichannel 'physical channels' when you do the AO control?

    Lama says:

    I did a sequence to ensure that each function has been run in the correct order. Wouldn't a race condition.

    All you have to do is wire the 'start of task' error at the entrance of error of the DAQ assistant and then back to 'stop task' and things will run in order. Guaranteed! Think the stream! Everything else can run in parallel or the order is irrelevant.

    First convert the sequence stacked to a sequence of plate, remove the flat sequence and add the mentioned son. Now, do a "cleaning pattern.

    A when stacked with the inhabitants of the sequence is one of the worst construction you can possibly do. It makes the code difficult to follow, impossible to maintain, difficult to debug.

  • Not a number/path/Refnum? Does not work with a reference SE

    Hi all

    I am writing a LabVIEW application and check that the Switch Executive session is valid before I allow the user to validate the test to run. I connect the not A number/path/Refnum? Function to reference session SE and it connects correctly, but the output of the function is never wrong even though I see the session reference is valid and non-null. Any ideas why this is?

    Thank you

    Nick

    It was a trick to convert a reference internal in an external shared library (usually a pointer memory) in a datalog refnum strict typedefed. This safely prevents a user to connect to what anyone, but this type of refnum at the VI in question. But this wasn't really a datalog refnum and the is not a number/path/Refnum refnum, which subsystem to question the validity of a refnum to determine based on the subtype. The LabVIEW datalog Manager ever created this refnum and hence will return correctly (not one of my refnums which is currently known to be valid).

    Because of this problem the misuse of datalog refnums as a unique resource identifier has been abandoned more in recent years. Also it will work with any external resources representing pointers memory when using 64-bit LabVIEW, since memory pointers are big in this 64-bit environment LabVIEW refnums are still 32-bit.

    Collate OR if they have a newer version of the Switch Executive in gestation or perhaps already out.

  • Dialog results 'not a number '.

    Hello! I am new to InDesign scripting (to date) and has difficulties with the help of dialog box results in my script. The script that I put in place creates calligraphy guide line to the bottom of a page and got this works well but then wanted to be able to specify the distance between the lines in a dialog box, rather than in the script, and it does not work now.

    I know that everything from line 43 down works if I remove the dialog box and create variables using parseInt() rather than pulling them from the box of dialogue, but as soon as I try to use the values of the dialog box, what happens with error on line 60 30491 that ascenderHeight is not a number (and so he can probably use it to calculate in geometricBounds). I tried to convert a variable to test entire under line 43, but it makes no difference. Initially, I used the measurementEditBox as in the tutorial of InDesign scripting, but thought that the whole it would remove any excess baggage. If someone could let me know where I am going wrong, I would really appreciate it!

    var myDialog = app.dialogs.add({name: "Set line guide parameters",canCancel:true}) ;
    with (myDialog){
    //Add labels dialog column.
    with(dialogColumns.add()){
        staticTexts.add({staticLabel:"X-height to ascender (mm)"});
        staticTexts.add({staticLabel:"X-height (mm)"});
        staticTexts.add({staticLabel:"Descender height (mm)"});
        staticTexts.add({staticLabel:"Slant angle"});
        }
    
    
    //Add entry dialog column
    with(dialogColumns.add()){
      //Create integer & angle entry fields.
        var ascenderHeightField = integerEditboxes.add({editValue:5}) ;
        var xHeightmmField = integerEditboxes.add({editValue:5}) ;
        var descenderHeightField = integerEditboxes.add({editValue:2}) ;
        var slantAngleField = angleEditboxes.add({editValue:-30}) ;
    }
    }
        //Display the dialog box.
        var myResult = myDialog.show() ;
        if (myResult == true) {
            //Get the values from the dialog box controls
            var ascenderHeight = ascenderHeightField;
            var xHeightmm = xHeightmmField;
            var descenderHeight = descenderHeightField;
            var slantAngle = slantAngleField;
            //Remove the dialog box from memory.
            myDialog.destroy();
            buildGuide (ascenderHeight, xHeightmm, descenderHeight, slantAngle);
            }
        else{
            myDialog.destroy() ;
            }
        
    
    
    
    
    
    
    function buildGuide (ascenderHeight, xHeightmm, descenderHeight, slantAngle) {
        
    var ascenderHeight = parseInt(ascenderHeight);
    
    
    var lineHeight = (descenderHeight+xHeightmm+ascenderHeight);
    
    
    //Create lines for guide, specified distance apart on margin of 13mm (set this in variables once maths is working!)
    
    
    var capHeight = app.activeWindow.activePage.graphicLines.add() ;
    capHeight.geometricBounds = [13, 13, 13, 197] ;
    capHeight.strokeWeight = 2 ;
    
    
    var xHeight = app.activeWindow.activePage.graphicLines.add() ;
    xHeight.geometricBounds = [(13+ ascenderHeight), 13, (13+ ascenderHeight), 197] ;
    xHeight.strokeWeight = 1.5 ;
    
    
    var baseLine = app.activeWindow.activePage.graphicLines.add() ;
    baseLine.geometricBounds = [(13+ +ascenderHeight+ xHeightmm), 13, (13+ascenderHeight+xHeightmm), 197] ;
    baseLine.strokeWeight = 2 ;
    
    
    var Descender = app.activeWindow.activePage.graphicLines.add() ;
    Descender.geometricBounds = [(13+lineHeight), 13, (13+lineHeight), 197] ;
    Descender.strokeWeight = 1.5 ; 
    
    
    /*app.activeDocument.distribute(
    app.activeWindow.activeSpread.pageItems.everyItem().getElements(),
    DistributeOptions.VERTICAL_SPACE, undefined, true, xHeightmm);*/ 
    
    
    //Create an x to mark the baseline and a diagonal at specified slant
    var lineMarker = app.activeWindow.activePage.textFrames.add() ;
    lineMarker.geometricBounds = [(13+ascenderHeight), 13,(13+lineHeight),17] ;
    lineMarker.contents = "X" ;
    
    
    var Diagonal = app.activeWindow.activePage.graphicLines.add() ;
    Diagonal.geometricBounds = [13, 30, (13+lineHeight+2), 30] ;
    Diagonal.strokeWeight = 1.5 ;
    Diagonal.absoluteRotationAngle = slantAngle ;
    
    
    //Group all created then duplicate down length of page
    var myGroup = new Array () ;
    myGroup.push(capHeight) ;
    myGroup.push(xHeight) ;
    myGroup.push(baseLine) ;
    myGroup.push(Descender) ;
    myGroup.push(lineMarker) ;
    myGroup.push(Diagonal) ;
    var myLineGroup = app.activeWindow.activePage.groups.add(myGroup);
    
    
    var myGroup2 = myLineGroup.duplicate(undefined,[0,lineHeight+2]);
    
    
    for (var i = lineHeight+2; i < (271-lineHeight); i=i+lineHeight+2){
        var dup_groups = app.activeWindow.activePage.groups.lastItem().duplicate(undefined, [0,i]) ;
        } ; 
    
    
    } ;
    

    Without going into all of your script, let's look at your dialog box:

    Take the code to your dialog box and copy it to a separate script.

    Now instead of calling the construction guide, replace this line with a test to check the values of variables:

    [ascenderHeight, xHeightmm, descenderHeight, slantAngle];

    When you run the script, you will see where is your problem: the result is:

    Result: [object IntegerEditbox], [IntegerEditbox object], [object IntegerEditbox] [object AngleEditbox]

    You have found a reference for widgets dialog box, not the edit value.

    Add .editValue to each of your definitions of variables so that they read:

    var ascenderHeight = ascenderHeightField.editValue;

    var xHeightmm = xHeightmmField.editValue;

    var descenderHeight = descenderHeightField.editValue;

    var slantAngle = slantAngleField.editValue;

    This should solve your problem.

    Bottom line: when you encounter problems, isolate the code and assess the results.

    I hope this helps.

  • Increase in the number of reported problems

    Hello world! I try to correct a package with the large number of errors. Unfortunately, I can't get the full list of errors due to

    "Warning (1,1): only 20 first problems are reported" restriction.

    Please, let me know how to avoid this restriction, and how to increase the number of reported problems (100 or more, for example) in the list if she could be available.

    Developer SQL 1.2.1 - version. Thanks to you all!

    Sorry, you can not - it is a restriction of the database.
    But that should not matter since you have to correct them anyway, no?
    If warnings are you too much trouble, you can turn them off in Preferences - Database - build PL/SQL - Performance Options .

    Kind regards
    K.

  • Does not touch the iPhone 6 after 18 months of use.  Apple Service Center is not able to solve the problem it could material being associated and returned the phone, now I'm stuck with this expensive junk, the Iphone above 6 serious problem?

    I am in India, I was using Iphone 6, 16GB, for the last 18 months, bought in Australia, progressively, the touch screen not responding. Then the problem started to happen frequently. I said, all ideas update, (9.3.2) reset, restore, etc., etc., nothing helped, finally the Apple so-called service center has confirmed that it is a hardware problem, is not repairable and advised me to return the phone and scrap it or to pay nearly 60% of the phone cost to get another phone as replacement. (It might be a refurbished phone).  As I see a lot of complaints in the blogs on the problems of the iphone 6, Apple has not taken any measure to solve my problem and trying to make more money on behalf of replacement... Now I'm stuck with such a pricey gadget... should I buy new Iphone?

    Sorry, but an iPhone can be repaired by Apple or a Service provider authorized Apple in the country of purchase. If you think of buying a new device, buy it in the country where you will use it will save you a lot of trouble if you need service.

    And, according to usage, a 16 GB model might not have enough free space left to work properly, which can also cause the phone to lag and unresponsive at times.

  • Hi, I just upgraded my 4s to 9.3.2 and now it is completely dead and will not start. Had no problem with any other previous updates.

    Hi, I just upgraded my 4s to 9.3.2 and now it is completely dead and will not start. Had no problem with any other previous updates.

    Sorted now

  • With Firefox my fonts e-mail decreased and will not respond to reset, but problem goes away when you use Explorer

    With Firefox my fonts e-mail decreased and will not respond to reset, but problem disappears when you edit from Internet Explorer. This happened with no incentives from me about two weeks ago, and no resets respond to the email. Occurs only with Fox. With ie I enlarged and adjustable policies.

    Have you tried to resize the text size by pressing CTRL and + at the same time (increase font size)?

    Otherwise, you can reset Firefox on its default settings by following the steps here: https://support.mozilla.org/en-US/kb/reset-firefox-easily-fix-most-problems

  • 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

  • Wil Windows 7 does not start and is not able to solve the problem

    Hello

    I tried several things at this stage. I have a Toshiba that windows is not able to solve the problem on its own when starting. InsydeH20 BIOS, I have ensured that the system must start using the HARD disc as shown.

    When the problem started he said that the problem could have been caused due to a media device may have been connected to the computer and that Windows could not fix the problem automatically. I was then able to enter the menu to try to do a system restore; It did not work. From that moment, I opened windows to use the F8 key and was able to start using the corrupted files, but now after a update tried to install all I get is a black screen with a white line of underscore flashing in the top left of my screen.

    I downloaded an ISO file for Windows 7 from my other laptop and was able to boot from there to get to the point where I would be able to try a system restore, use the prompt, etc., but even once it is not solved the problem.
    At some point, the screen showed that there is a cable that is not connected or something, I don't not entered all of this, but I do not know how to check this part of it. Could someone please give me direction from here to what I can do?

    Thank you

    > However now after a tried update install all I get is a black screen with a white flashing line of underscores in the upper left corner of my screen.

    This is a typical symptom for a faulty HARD drive.
    I had the same cursor blinking in the upper left corner and finally I could solve this problem using the new HARD disk.

    > At some point, the screen showed that there is a cable that is not connected or something.
    Maybe you mean the error: pxe/e61: mediatest failure, check the cable of
    This happens if the portable computer is trying to boot from LAN. This happens because the OS on the HARD drive is not bootable, and this happens especially if the HARD drive is malfunctioning

    In my opinion, you need to change the HARD drive.
    I think this should solve the problem.

  • I have an iPhone 5 that answering an appeal not heard anything. The problem is solved by rebooting the mobile phone. What is going on?

    I have an iPhone 5 that answering an appeal not heard anything. The problem is solved by rebooting the mobile phone. What is going on?

    Try a forced reboot. Hold down the home and Sleep/Wake buttons simultaneously for about 15-20 seconds , until the Apple logo appears. Ignore the "Slide to power off" text if it rises. You won't lose anything.

  • I bought an update of AVG security. He does not load because of a problem with your registration of chrome. ?????

    I buy another year of AVG security. It will not load due to a problem of "chrome registration" (pop-up). He told me to contact you. Please help I have alreay paid for it and I'm about to miss my old version. Thank you.

    User Agent

    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.4; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30729;. OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.30729; yie8; Creative ZENcast v2.00.13)

    Try launching Firefox as administrator once.

    Right-click on the Firefox icon and select Run as Administrator.

    See Chrome registration.

  • Refnum control is not a number/path/refnum

    Hi all

    I'm working on a LV7.1 program. It has a control refnum on the façade. If this control is not signed by the appellant, the follow-up 'Not a number/path/refnum' will return TRUE. It's like a 'default'. But I don't know how to implement this function. I mean, I can't find a way to set the control of refnum with a default value as "not a number/path/refnum". Can someone give me a hint?

    Thank you

    stable

    Under file e / s-> constants file, there is a constant "not a Refnum". (Why under file e/s? Do not know?)

    You can change your control to an indicator, it wire up to now, the VI run once and then change things at the back (you now have not a Refnum value).  You can then make it worth stick by right-clicking on the control of data operations by choosing-> do default to the current value.

    This assumes that the control has managed to be pre-initialized with one value other than not a refnum.

Maybe you are looking for