Repeat/loop small amount of code.

Hi how to make this code is constantly repeating, because it runs once. Im not very good with the listeners, I know functions and variable etc. If im not so bad. Help, please.

Code:

If (health < = 0) {}
gotoAndStop ("mainDead");
}

Its on a framework, not a MC.

AC 2

Thank you.

Try the following...

this.onEnterFrame = function() {}
If (health<=0)>

delete onEnterFrame;

gotoAndStop ("mainDead");
}
}

Tags: Adobe Animate

Similar Questions

  • Repeat the small piece of code 1-100 hundred times with each code with a different instance name?

    Hi, here is a part of my code:

    player_mc.onEnterFrame = function() {}

    If (enemy0.hitTest (this)) {}

    enemy0. Speed = 0;

    } else {}

    enemy0. Speed = 1;

    }

    If (enemy1.hitTest (this)) { }

    enemy1. Speed = 0;

    } else {}

    enemy1. Speed = 1;

    }

    };

    Note the Red code, I need to repeat an unknown quantity still, but with the number on the end of the enemy incremented by 1 each time. It starts with 0 as you can see the code just above the red. I've heard for loops using 'i' but I'm not sure how to use. Please help and explain if possible. Thanks for reading and/or you answer.

    Edit: ah, this forum is not to let me highlight red. This editor is also a failure. Well, when I say code red this code:

    If (enemy1.hitTest (this)) {}

    enemy1. Speed = 0;

    } else {}

    enemy1. Speed = 1;

    }

    You can use a for loop but you should have the number of enemies available somehow.   To be able to target the many enemies by using the same code in a loop, the notation vracket is used as a string value is interpreted as an object...

    player_mc.onEnterFrame = function() {}

    for (i = 0; i

    If (_root ["enemy" + i] .hitTest (this)) {}

    _root ["enemy" + i] .speed = 0;

    } else {}

    _root ["enemy" + i] .speed = 1;

    }

    }

    }

    This code assumes that the enemies are on the main timeline.  Will they live elsewhere then you need to adjust the targeting

  • KB2183416 Windows Update for IE8 repeatedly fails with the error code "WindowsUpdate_8007371C" "WindowsUpdate_dt000"

    KB2183416 Windows Update for IE8 repeatedly fails with the error code "WindowsUpdate_8007371C" "WindowsUpdate_dt000"

    Whenever I run this update, it seems that it installs about 90% of the way but then stops and breaks down about 20 seconds later.  If someone else sees this problem and is at - it a solution?  I'm running Vista Home Premium SP2 and KB2183461 is listed as a critical update for my system.  Help?

    Preliminary stage: If the Tea Timer of Spybot is enabled, please disabled until we finished this thread. Seehttp://aumha.net/viewtopic.php?f=26&t=32409

    Tip: If you don't fully understand what Tea Timer does and how it does, leave it disabled permanently.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    McAfee applications (and Norton) are known for not not upgrade (or uninstall) "clean". If you have McAfee Security Center installed since you bought the computer, he is been updated (automatically) several times. Try the following:

    1. run this triple McAfee fix: http://service.mcafee.com/FAQDocument.aspx?id=TS100507

    2. after reinstallation of McAfee Security Center to step #3 patch triple, manually & repeatedly updated McAfee Security Center until you get one invite "no updates more".

    3. OPTIONAL: If you have had problems with IE8, open IE8 (only) to http://support.microsoft.com/kb/923737 & run the difficulty.

    4. OPTIONAL STEP: Open IE8 (only) to http://support.microsoft.com/kb/971058 & run the difficulty by DEFAULT inside and modes and AGGRESSIVE. [1]

    5 restart and test by launching a manual check of updates & see if KB2183461 now installs. See...

    How will I know if my computer is up to date?
    http://Windows.Microsoft.com/en-us/Windows-Vista/how-can-I-tell-if-my-computer-is-up-to-date

    ~~~~~~~~~~~~~~~~~~~~~~~~
    [1] full Disclosure: the difficulty operating in AGGRESSIVE mode will remove your update history but not list the updates installed in Add/Remove Programs (Windows XP) or updates installed (Vista & Win7).

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • small amount of soup at the event, display problem

    Small amount of soup contacted the side of my laptop, where evacuation, the laptop has flashed blue waves. Sometimes, it works very well but most of the time, it flashes waves blue and sometimes black or gray rest until never. Help, please

    SIMZCOOL

    Sorry, but it seems that some of the internal components is wet soup and are at short-circuit.

    This will only get worse until something finally completely fails.

    What you need to do is to find a certified HP repair center and pay to clean the laptop.  This is not going to be cheap.  But if you don't do this, it will fail.

    Good luck

    I'm a volunteer and I do not work for, or represent, HP.
    ========================================================================
    If you feel that my suggestions helped you, please click on the thumbs-up symbol to say thank you!

    If they helped to solve your problem, please click 'Accept as Solution' to help others find similar information.

  • I repeated the small size of message in the folder C

    I repeated the small size of message in the folder C

    Hello

    · Were there any changes made on the computer before the show?

    I suggest you follow the steps below:

    Run the disk cleanup on the computer. You can check the link for the procedure: Description of the tool in Windows XP Disk Cleanup: http://support.microsoft.com/kb/310312

    Also check out the link and try the steps listed in the link: how to make a computer faster: 6 ways to speed up your PC: http://www.microsoft.com/atwork/maintenance/speed.aspx#2

  • Why this small piece of code work

    A small piece of code, but get an error. What I'm missing here.

    Here is the error message:
    Invalid CFML construction found on line 27 in column 67.
    ColdFusion has been looking at the following:

    LTE

    The CFML compiler treated:

    * an expression starting with "#", on line 27, column 11. This message is usually caused by a problem in the structure of expressions.
    * The body at the beginning of on line 24, column 2 cfoutput tag.

    who did it, thanks

  • control flash movieClips from inside the repeat loop

    Hi guys

    I have a flash sprite in my partition that contains 20 movieClips named button1 to button20.
    I'm trying to rewind the movieClips touch to their executives 1 go in a loop of repetition, I tried a few different methods, but may not know!

    This code works: sprite (11).button1.goToAndStop (1)

    Does anyone at - he had success this?


    Thank you very much

    Hi guys, I thought about it.
    I ended up setting a benchmark for the clips using getVariable()

    Posted the code, might be useful!
    -------------------------------------------------------------------------------
    pFlashButton property

    Repeat with i = 1 to 20
    pFlashButton = getvariable (sprite (11), #button & i, False)
    pFlashButton.goToAndStop (1)
    end repeat
    -------------------------------------------------------------------------------

    See you soon

  • KB2310138 repeatedly fails with the error code 8004FF80

    Windows Vista 32-bit system:

    Windows repeatedly update fails when trying to install the KB2310138 updates.  Each failure is accompanied by an error code 8004FF80.  The problem is ongoing for more than 30 days.  Microsoft Security Essentials is obviously having a problem, even if the icon is green and the program reports that it is up-to-date.  All solutions?

    See if this FAQ makes things clearer for you-online http://answers.microsoft.com/thread/74e507b8-f6da-4eca-8ce7-d1aca7d3f1ba

    In these forums, you will find some support for Microsoft Security Essentials (MSE): http://answers.microsoft.com/en-us/protect/forum/mse

  • Audio display problem - stutter, repeat / loops

    I'm having a problem after making and exporting to a file, a small part of the audio stutters and repeats. I tried to export using different codecs (h.264, pro res) - the problem persists. It's always the same audio portion each time.

    As a test, I isolated this part and marked on/off it has exported as a clip and the problem was gone. The problem seems to occur only when I try to export the entire sequence. Other tests I tried and failed: place in a layer of audio slug, export audio as a .acc and re-import audio on a single layer and turn off all audio layers existing

    I use SOUL for export. Another problem (?) when I try to do a direct export of first - it goes right down.

    Someone at - it this problem and workarounds? Thank you

    System:

    iMac 2013

    El Capitan 10.11.5

    Latest creation CC Pro, SOUL CC update

    Update Premiere Pro. It should be fixed.

  • I want to use for the next loop to reduce the code to make of removechild)

    I work if (addChild (bmp1)) - removeChild (bmp1). But I need to do it 20 times. I thought I could use a for/next loop, but this day can't do things.

    for (var i: Number = 0; i < 21;) I ++)

    {

    my_bmp. Name = "bmp" + 1;

    If (addChild (my_bmp))

    {

    removeChild (my_bmp);

    }

    }

    }

    This code from the compiler, but when I run it I get "a term is undefined and has no properties." I think it has something to do with my_bmp.name? I tried several things and just cannot break.

    The name of an object is just a string.  for the compiler to treat it as an object, you can use the getChildByName() method or even the support rating.

    removeChild (this.getChildByname (my_bmp));

    OR

    removeChild (this [my_bmp]);

    I'm guessing that you intend to use "bmp" + String (i) instead of "bmp" + 1

  • Adding a loop to the following codes

    I would like to add a loop for this codes below

    var myTimer: Timer = new Timer (1000);

    myTimer.start ();

    myTimer.addEventListener (TimerEvent.TIMER, nextPic)

    function nextPic(e:TimerEvent):void {}

    If (currentFrame == 5)

    {

    gotoAndPlay (1);

    }

    on the other

    {

    nextFrame();

    }

    }

    In frame 1 use:

    var from: Boolean;

    {if (!) Starting)}

    Start = true;

    var myTimer: Timer = new Timer (1000);

    myTimer.start ();

    myTimer.addEventListener (TimerEvent.TIMER, nextPic)

    }

    function nextPic(e:TimerEvent):void {}

    If (currentFrame == 5) {}

    gotoAndPlay (1);

    } else {}

    nextFrame();

    }

    }

  • a repeat loop

    Hi, I need the error message that the first time, seems. See the attached file. When the error in the string it appears errormessage, but he continues to repeat every time it senses the right channel Match.What is best way to handle this case? any suggestions? Thank you.

    As the previous poster indicated, place the flag in a shift register, which is reset by any boolean you start the test with. See attachment.

  • KB2597086 repeatedly moved with Ox57A error code

    I get an error Ox57A installation code trying to do an automatic update of Office 2003 KB2597086.

    Hi Meg9,

    ·         Did you do changes on the computer before the show?

    ·         What is the full error message?

    ·         You are able to install other updates successfully?

    Follow these methods.

    Method 1: Temporarily disable the security software.

    Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you do not disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network during the time that your antivirus software is disabled, your computer is vulnerable to attacks.

    Method 2: Put the computer in a clean boot state to see if there is a software conflict as the clean boot helps eliminate software conflicts.

    How to configure Windows XP to start in a "clean boot" State

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

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration Utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click restart to restart the computer.

    Method 3: You can also manually install updates (KB number) by downloading from the Microsoft Download Center.

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

    Method 4: Follow the steps in the article.

    How to reset the Windows Update components?

    You cannot install some programs or updates

  • The Installation of Acrobat has failed repeatedly to 99% with exit code: 1603

    The Installation of Acrobat CC XI always stops at 99%, I am a CC member, tried to download and install Apps anymore on a Windows 7-64 Bit-system using the installer-CC. Installation failed at 99%. I tried to download and install Acrobat again, same problem, no warning nor any info or the available log file. Finally had to close Setup CC and lost my download hereby had to begin again with the same result.

    Four other CC-Apps could be dounloaded and installed successfully before. Need help!

    Adding / Addendum:

    about 20 minutes later, after all he finally will display an info and an error code, as quoted below:

    -------------------------------------- Summary --------------------------------------

    -0 fatal Error (s), 3 (s)

    -Payload: Acrobat Professional 11.0.0.0 {23D3F585-AE29-4670-8E3E-64A0EFB29240}.

    ERROR: An error occurred during the installation of Assembly component {76C3F0F6-9B9D-35DA-81C6-CA8A88CC93CA}. HRESULT: 0X800736FD.

    ERROR: Install payload MSI failed with the error: 1603 - Schwerwiegender Fehler bei der Installation.

    MSI error message: an error occurred during the installation of Assembly component {76C3F0F6-9B9D-35DA-81C6-CA8A88CC93CA}. HRESULT: 0X800736FD.

    ERROR: installer of third party AcroPro.msi payload failed with exit code: 1603

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

    In addition: the installer CC soon inacceptably, it took an hour to get 10% of the download, and it wasn't because of the available bandwidth.

    Have you checked the MS recommendations at http://support.microsoft.com/kb/834484 for this error? You log on as an administrator? You have disabled antivirus. Have you installed the rest of the CC and activated? CC and CS have a few special installation steps that are not part of Acrobat. You can check the CC forum for more information on the installation of Acrobat as part of the CC.

  • Debug a small piece of code

    I'm working on a few scroll arrows that move a Clip up and down before they reached their maximum length. It works to move the clip to the top, but it does not stop at the maximum height, but retains the right to go. Here is the code from the image:

    topspan = - 560;
    bottomspan = 7.8;
    ValeurDeplacement = 10;



    Here is the code for the button:

    on {(overview)
    If (_root.predes._y > topspan) {}
    onEnterFrame = function () {}
    _root. PREDES._y = _root.predes._y - ValeurDeplacement;
    trace ("PREDES Y:" + _root.predes._y + "is superior to" + topspan);
    }
    } else {}
    onEnterFrame = null;
    }
    }

    (deployment, dragOut, releaseOutside) {}
    onEnterFrame = null;
    }


    The trace command shows me what is happening. _root. PREDES._y gets lower and lower, until finally she is less than topspan. At this point, it should make the statement "else" and onEnterFrame set to null. But it is not that. Instead, I get a trace statement that says "PREDES Y:-662.2 is greater than-560.

    Dragout/deployment/releaseoutside code works very well.

    Thank you, Craig. (The temptation to hit my forehead and scream "duh" is overwhelming).

Maybe you are looking for