How would you change an integer variable per second

Im new to action script, and I'm working on a game were your health variable will add 1 hp automatically every second if the health variable is not equal to 100. How would you do that?

If you are using AS3, you can use the Timer class.  You can specify it to activate every second and use an event listener.event handler function to add to the value if it is less than 100.
var healthTimer:Timer = new Timer(1000);
function addHealth(evt.TimerEvent):void {
     if(health < 100) health += 1;
healthTimer.addEventListener(TimerEvent.TIMER, addHealth);
healthTimer.start();
If you are using AS2, look into setInterval().

Similar Messages

  • How would you change the state to the base state?

    How would you change the state to the base state? Its not
    letting me do something like:
    currentState='<Base State>';

    Sorry about the vagueness of that last reply :)
    What I have done now in my code is this:
    viewstack1.addChildAt(loginCanvas,0);
    toggle.selectedIndex = 0;
    However nothing happens at this line of code:
    toggle.selectedIndex = 0;
    but this works:
    toggle.selectedIndex = 1; or ...
    toggle.selectedIndex = 2;
    toggle.selectedIndex = 3;
    toggle.selectedIndex = 4;
    toggle.selectedIndex = 5;
    toggle.selectedIndex = 6;
    The strange thing is that if I have a button on the screen:
    <mx:Button x="10" y="3" label="Button"
    click="toggle.selectedIndex =0"/>
    and the user clicks it the toggle.selectedIndex = 0; works.
    I'm stumped, any ideas?

  • How would you change the default template?

    How would you change the default template?

    Hi,
    what do you mean by changing the default template? Do you want to change the standard BEx web template for all web applications? This can and should be done with transaction SPRO, there you can change it to your own (maybe by copying the standard template and fitting it to your needs).
    With regards,
    Daniel

  • If you know your password to iTunes but forgot your sercurity questions how would you change them?

    If you know your password to iTunes but don't know your sercurity question answers how do you change them?

    Welcome to the Apple Community.
        1.    Start here (change country if necessary) and navigate to 'Password and Security', reset your security questions using the link provided, you will receive an email to your rescue address, use the link in the email and reset your security questions.
        2.    If that doesn't help, you don't receive a reset email or you don't have a rescue address, you should contact AppleCare who will initially try to assist you with a reset email or if unsuccessful will pass you to the security team to reset your security questions for you.
        3.    If you are in a region that doesn't have international telephone support try contacting Apple through iTunes Store Support.

  • How would you change the name of your mac? because i have a mac but its under my friends name because he set it up for me and i would like in under my name how would i change that?

    ?

    Hi D,
    That would do nothing as one needs to select an item at first in order to be able to select all, but I would like to know what is the information you would like to know about the OP's machine and, if possible, the reason.
    The correct procedure is the one that A posted before.
    Regards, K.

  • In Security, clicking on the "Saved Password" button displays your current saved password for each site. It does not allow you to change a password. How would you do that?

    In Security, clicking on the "Saved Password" button displays your current saved password for each site. It only allows you to view and delete site passwords. It does not allow you to change a password. How would you do that?

    If you enter a new password Firefox should offer to change the password.
    *You may not need to delete the old password. Try "Refreshing" the page, entering the site again, you may need to let Firefox fill in the old password, then enter the new password, and Firefox should ask to save the new password. See:
    **http://kb.mozillazine.org/Deleting_autocomplete_entries
    *If you delete the old password, you may need to "Refresh" the site after deleting the old password.
    If you want to delete the password that has been saved do the following:
    #In the Tools menu select Options to open the options window
    #Go to the Security panel
    #Click the "Saved Passwords" button to open the passwords manager
    #Select the site in the list, then click Remove
    <br />
    <br />
    '''You need to update the following.''' The Plugin version(s) shown below was/were submitted with your question and is/are out of date. You should update to avoid known security issues with the version(s) you have installed. Click on "More system info..." to the right of your question to see what was included with your question.
    *Adobe PDF Plug-In For Firefox and Netscape 8.3.0 (''Note: this is a very old version and installing the current version may not delete it or overwrite it. To avoid possible problems with having 2 versions installed on your system, you may want to remove the old version in Windows Control Panel > Add or Remove Programs before installing the new version'').
    *Shockwave Flash 10.3 r181 (''this may be current but a new version was released on 2011-06-14 with a ".26" after the "181". You can use the Plugin Check below and/or look in Add-ons > Plugins for the version of Shockwave Flash that you have installed. The newest version will be shown in Add-ons > Plugins as "Shockwave Flash 10.3.181.26"'').
    *Next Generation Java Plug-in 1.6.0_24 for Mozilla browsers
    #'''''Check your plugin versions''''' on either of the following links':
    #*http://www.mozilla.com/en-US/plugincheck/
    #*https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #*There are plugin specific testing links available from this page:
    #**http://kb.mozillazine.org/Testing_plugins
    #'''Update Adobe Reader (PDF plugin):'''
    #*From within your existing Adobe Reader ('''<u>if you have it already installed</u>'''):
    #**Open the Adobe Reader program from your Programs list
    #**Click Help > Check for Updates
    #**Follow the prompts for updating
    #**If this method works for you, skip the "Download complete installer" section below and proceed to "After the installation" below
    #*Download complete installer ('''if you do <u>NOT</u> have Adobe Reader installed'''):
    #**SAVE the installer to your hard drive (save to your Desktop so that you can find it after the download). Exit/Close Firefox. Run the installer you just downloaded.
    #**Use either of the links below:
    #***https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox ''(click on "Installing and updating Adobe Reader")''
    #***''<u>Also see Download link</u>''': http://get.adobe.com/reader/otherversions/
    #*After the installation, start Firefox and check your version again.
    #'''Update the [[Managing the Flash plugin|Flash]] plugin''' to the latest version.
    #*Download and SAVE to your Desktop so you can find the installer later
    #*If you do not have the current version, click on the "Player Download Center" link on the "'''Download and information'''" or "'''Download Manual installers'''" below
    #*After download is complete, exit Firefox
    #*Click on the installer you just downloaded and install
    #**Windows 7 and Vista: may need to right-click the installer and choose "Run as Administrator"
    #*Start Firefox and check your version again or test the installation by going back to the download link below
    #*'''Download and information''': http://www.adobe.com/software/flash/about/
    #**Use Firefox to go to the above site to update the Firefox plugin (will also install plugin for most other browsers; except IE)
    #**Use IE to go to the above site to update the IE ActiveX
    #*'''Download Manual installers'''.
    #**http://kb2.adobe.com/cps/191/tn_19166.html#main_ManualInstaller
    #**Note separate links for:
    #***Plugin for Firefox and most other browsers
    #***ActiveX for IE
    #'''Update the [[Java]] plugin''' to the latest version.
    #*Download site: http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)
    #**'''''Be sure to <u>un-check the Yahoo Toolbar</u> option during the install if you do not want it installed.
    #*Also see "Manual Update" in this article to update from the Java Control Panel in Windows Control Panel: http://support.mozilla.com/en-US/kb/Using+the+Java+plugin+with+Firefox#Updates
    #* Removing old versions (if needed): http://www.java.com/en/download/faq/remove_olderversions.xml
    #* Remove multiple Java Console extensions (if needed): http://kb.mozillazine.org/Firefox_:_FAQs_:_Install_Java#Multiple_Java_Console_extensions
    #*Java Test: http://www.java.com/en/download/help/testvm.xml

  • How do you change the variable screen on Portal to show Key?

    Hi All,
    I have a report on our Portal.  In the variable screen, the users are asked to optionally enter Cost Centre.  When they choose to select values (pressing the button on the right) the singles values which are shown are 'Text' only.  I know in analyser, the user can switch by selecting the spanner icon - 'Display Key/Text'
    How do you change to Key within the variable screen on the portal?
    Many Thanks
    Michelle

    Thank you for your reply Amrita,
    The display in the query had been set to Text & Key as follows
    Properties of Cost Centre -> Display Tab -> Value Display Section -> Display As 'Text and Key', Text View 'Standard' and Use Characteristic Setting 'Unticked'
    Is there another section that I should be amending to ensure the 'Key' also appears in the variable screen?
    Many Thanks,
    Michelle

  • I need to change my apple id in my ipod (it was an old email address).  How would you do this?

    I need to change my apple ID in my ipod touch (it was an old email address).  I have changed to setting in itunes.  How would you do this? - not sure what my OS is.

    Go to Settings>Store (or Settings>iTunes and App Stores for iOS 6) and sign out and sign in with the other/updated account.

  • Text variables. How do you change time zone?

    I am trying to set up a text variable for modification time. However, it is not registering my time zone. How do you change the time zone?

    Sorry. I have worked it out that it is in my timezone!!

  • In IOS 6 my date format was YYYY-MM-DD. When I switched to IOS 7, it changed to MM-DD-YYYY. How do you change it?

    In IOS 6 my date format was YYYY-MM-DD, which is ISO 8601 standard used in Canada.  When I switched to IOS 7, it changed to MM-DD-YYYY format which is very confusing as all my cameras etc use YYYY-MM-DD.  How do you change it, like one can in OSX?

    It appears previous versions of IOS would pick up your preferred date format from your OSX Mac. You can modify that to whatever you like.
    Now if you select Canadian or American in IOS 7 you get only MM-DD-YYYY.  This is wrong for Canada as the preferred date format here is YYYY-MM-DD, just check your birth or expiry dates on your Ontario Drivers License or OHIP Health Card.  Or the date field at the bottom left of any Government of Canada website.
    The trouble with using other Country codes is you tend to get their currency codes like € or £ and the terms like yesterday and today in their language.

  • HT1918 How can you change your security account questions

    After your account has been unlocked after eight hours how do you change the security questions answered if you have forgotten ?

    Check the AppleCare number for your country here:
    http://support.apple.com/kb/HE57
    Call them up, and let them know you would like to be transferred to the Account Security Team.

  • How can you change your security questions and answers if it doesn't show the link forgot answer?

    how do you change your security questions/answers if it does not show the link forgot answers

    Hi, Morganr2954.  
    Thank you for visiting Apple Support Communities.  
    I understand that you want to reset your security questions.  Here is an article I would go though for this.  
    If you forgot the answers to your Apple ID security questions
    http://support.apple.com/en-us/HT201485
    Cheers, 
    Jason H.  

  • How do you change the direction of a Tween Wipe effect

    Hi all,
    Completely new to the forums and I hopefully my query is straight forward.  How do you change the direction in the pre-built tween effects available within Flash CS3 (primarily the Wipe effect).  Example code:
    var Animate_Box:Tween = new Tween(Box, "height", Strong.easeInOut, 0, 200, 1, true);
    OR
    var Animate_Box_2:Object = {type:Wipe, direction:Transition.IN, duration:1, easing:Strong.easeInOut};
    TransitionManager.start(Box_2, Animate_Box_2);
    Many thanks in advance.
    Kam
    ANSWERED:
    Sorry for posting something so pointless!
    You simply add 'startPoint:5' onto the end i.e.
    var Animate_Box_2:Object = {type:Wipe, direction:Transition.IN, duration:1, easing:Strong.easeInOut, startPoint:5'};
    TransitionManager.start(Box_2, Animate_Box_2);
    startPoint:5' = can be any number depending on the direction of the Wipe you want.
    Thanks,
    Kam

    What you really want is a way of automatically mirroring the the X and/or Y coordinates of the keyframes within the effect. This ability would be very useful.
    But right now there's no way to do that. You'd have to do it manually. That effect actually uses the Slide parameter to generate the movement (instead of a discreet X/Y coordinate for the position.) Changing the first keyframe value of the Slide parameter to a negative number still doesn't give the effect I think you're looking for.
    So, it's probably easier to just rebuild the effect the way you want it from scratch.
    Bony

  • How do you change an iphoto size to 300DPI high res for exporting

    How do you change an iphoto  to 300 DPI high res for exporting to email?

    Short answer: the dpi is set when you decide what size you're printing at.
    Long Answer: Dpi means nothing in the digital world of your computer. There are no "inches" to have "dots per..." Size is measured in pixels. That's the same on your camera. It doesn't take 10 x 8 or 6 x 4 shots. It takes shots measured in megapixels. For instance 4,000 x 3,000 is a 12 megapixel camera.
    Using that example, that shot from that camera has 12 million pixels. So that's how many "Dots" there are. To decide the ratio of dots per inch, you now need to decide the "inches" part. And that's printing.  Print at 10 x 8 and the dpi will be 4,000/10 or about 400 dpi. At 6 x 4 then it's 4,000/6 or 660 dpi. Work the other way: Print at 300 dpi and the resulting image will be about 13 inches on the longer side.
    So, your photo as a fixed number of pixels. Changing the dimensions of the print will vary the dpi, changing the dpi will vary the dimensions of the print.
    For more see http://www.rideau-info.com/photos/mythdpi.html
    To export: File -> Export.
    Regards
    TD
    Regards
    TD

  • How do you change the opacity of a button when it is rolled over?

    I have the button created i am not trying to change the background or anything. I wanted to know how do you change the opacity for the over state of a button? by the default i have it set to 70% opacity i want to change the over state to 100%

    You'll need to leave the overall opacity of the button symbol at 100%, then modify the opacity of each state (up, over, down, etc.) individually. The individual states cannot override a symbol setting. For instance, if your symbol was set to 50% opacity, setting the over state to 100% would only give you 100% of 50% opacity.
    Make sense?

Maybe you are looking for

  • Avid Format Compressor Export for Pro Tools

    Pro Tools now has support for Avid Media Files - to play out their I/O Box - The Mojo. Unfortunately, they have to be in a proprietary format; near as I can tell, MXF, AAF, or OMF. I can DL the Avid Codecs, and Compressor can use these, but is there

  • Need help on Info Cube.

    Hi All,   I have a query on designing the Cube. My Requirement : I have Standard ODS and the keyfigures in ODS are 1. Service Order Number. 2. User Status. 3. User Date. 4. User Time Data field in ODS is 1. Active Flag. Active flag gives the informat

  • Urgent Billing related Issue

    Dear SD Gurus !!! I have an issue in billing... The requirement is to Bill Monthly on One Invoice per Shipping Location showing detail order information (material, quantity, unit price, etc). So for the particular Sold To - we need monthly invoices w

  • I can't install any apps on my phone

    I bought a new cellphone and I can't install any app on my iPhone 5s ! I go to abroad , I had installed viber on my iPhone 4 , 2years ago but now I couldn't install again it on my iPhone 5s Could you help me?

  • ARUN In SAP AFS

    Hi All,              What is Alocation run SAP AFS .. how to configure the ARUN .. Is it mandatory in MTO Scenario Regards/smith