Shouldn't variables reset each time the frame plays?

In my flash program I have everything on one frame. In the actionscript on that frame, I made a variable called currentButton and set it to the first button, to keep track of which button is currently pressed. In the click function this variable is changed to whatever button was clicked.
Now, I didn't think this would work, because seeing that the one frame is being played over and over, (there's no stop() command in there) I thought currentButton would keep being reset every frame. To my surprise, it worked just fine. Not that I'm complaining, but I'd like to know why it's doing that. Shouldn't all the code on the frame be done every time the frame is played, including the part that sets currentButton to button1?

The frame is not played over and over... you can easily test by just putting trace("hello"); in frame 1 and testing. You'll see hello only one time. Unless you have more than one frame, the stop is automatic.

Similar Messages

  • HT5312 I forgot the answers to my securtiy questions so I had apple send me an email to reset them, however I have not recieved the email.  I've tried this many times and each time the email was never sent.

    I forgot the answers to my securtiy questions so I had apple send me an email to reset them, however I have not recieved the email.  I've tried this many times and each time the email was never sent

    If you aren't receiving the email to your rescue email account (and you've checked the spam folder on it as well as the inbox) then you will need to contact iTunes Support / Apple in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699

  • The last 3 or 4 times I have tried to access my account, it has told me it has been deactivated and I have to reset each time, or give credit card info again.  Why is this happening and how do I stop it?

    The last 3 or 4 times I have tried to access my account, it has told me it has been deactivated and I have to reset each time, or give credit card info again.  Why is this happening and how do I stop it?

    You must contact iTunes support to get the problem resolved.
    http://www.apple.com/support/itunes/contact/
    If there is a problem with your account or payment info, you cannot
    download anything (including free apps or updates) until the matter
    is resolved.
    In countries where the iTunes Store only sells apps, the accepted payment methods are Visa, MasterCard, and American Express. Other payment types such as gift cards, store credit, monthly allowances, ClickandBuy, and PayPal are not accepted. Depending on your App Store country, prices may be listed in your local currency, US Dollars, or Euros.    http://support.apple.com/kb/HT5552

  • My computer struggles to log in. I have to shut it down each time the computer has been shut and asleep for a few hours. The first day it happened my desktop photo was reset.

    My computer struggles to log in. I have to shut it down each time the computer has been shut and asleep for a few hours. The first day it happened my desktop photo was reset.

    Have you tried a PRAM reset?
    http://support.apple.com/kb/HT1379
    Ciao.

  • How do I save my Home sharing details on Apple TV. It resets each time I leave COMPUTER ...

    How do I save my Home sharing details on Apple TV. It resets each time I leave COMPUTER ...

    Welcome to the Apple community.
    What makes you think it is resetting, are you sure it is not simply disconnecting.

  • How can I stop a sound from looping so it plays only once each time the up key is pressed?

    Hi there here is my code, the basis is it is playing a mp3 from my library.
    Basically as the topic suggests I only want the sound to play once each time the UP arrow key is pressed. At the moment when you hold the up arrow down the sound keeps triggering and looping and gets really loud and noisy.
    Here is my code for my game:
    package com.chasegame.components
              import flash.display.MovieClip;
              import flash.display.Stage;
              import flash.events.Event;
              import com.tech.utils.KeyObject;
              import flash.ui.Keyboard;
              import flash.media.Sound;
              import flash.media.SoundChannel;
              public class SpaceShip extends MovieClip
                        private var key:KeyObject;
                        private var speed:Number = 0.3;
                        private var rotateSpeed:Number = 5;
                        private var vx:Number = 0;
                        private var vy:Number = 0;
                        private var friction:Number = 0.95;
                        private var shipSound:roar = new roar();
                        private var shipSoundChannel:SoundChannel = new SoundChannel();
                        public function SpaceShip () : void
                                            key = new KeyObject(stage);
                                            addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
                        public function loop(e:Event) : void
                                            if (key.isDown(Keyboard.UP))
                                                           vy += Math.sin(degreesToRadians(rotation)) * speed;
                                                           vx += Math.cos(degreesToRadians(rotation)) * speed;
                                                           shipSoundChannel = shipSound.play();
                             else
                                                           vy *= friction;
                                                           vx *= friction;
                                  if (key.isDown(Keyboard.RIGHT))
                                            rotation += rotateSpeed;
                                  else if (key.isDown(Keyboard.LEFT))
                                            rotation -= rotateSpeed;
                                  y += vy;
                                  x += vx;
                                  if (x > stage.stageWidth)
                                            x = 0;
                                  else if (x < 0)
                                            x = stage.stageWidth;
                                  if (y > stage.stageHeight)
                                            y = 0;
                                  else if (y < 0)
                                            y = stage.stageHeight;
                        public function degreesToRadians(degrees:Number) : Number
                                  return degrees * Math.PI / 180;

    If you want the sound to only play once when the key is pressed then you don't want to have it in the ENTER_FRAME event handler like you have it.  It is starting new sounds at the frame rate of your file the way you have it now.
    Try having an event listener dedicated to a KeyboardEvent.KEY_DOWN event where you detect when the UP key gets pressed and use that to trigger playing the sound.

  • How to create a unique file name each time the form is saved?

    I've got a form with several data items. When the user saves the form, it saves it as an .xml file. So far so good. But then I want the user to be able to start over and put in a new data set. I used the reset form button and this clears out the old data. But when the user goes to save the form for the second set of data, the default name of the .xml file is the same as the last record set. How do I get LCD to create a unique data name each time the form is saved? I know that the user can enter a new name, but I do not want them to have to think that much.
    Alternatively, is there a way that a user can enter several forms of data and save all of the data in one XML file that my PDF can scroll through or that I can import into excel and keep all of the data sets separate?

    Thanks Paul for the post. It sounds like this program is simply not designed for one user to keypunch a batch of forms. It would appear to limit the program's use to users who only need to key in one record/form. While a good solution for multiple users who need to enter just one set of data, the limitation would explain why this program is not widely used.

  • IPod 60GB resets each time it turns on?

    Is it normal for a 60GB iPod to reset...so the apple logo shows up...each time the ipod is turned on? It's never happened to me before and its annoying. Also, how loud is the ipod's HDD supposed to be, I find that when I tip my ipod from side to side, I hear a faint screeching noise.

    After 14 hours of inactivity, the iPod goes into hibernation mode. After this, it will appear to reset when started again.
    http://docs.info.apple.com/article.html?artnum=60945
    Cheers!
    -Bryan

  • HT204053 We both use the same iPad my father and I as of today, because I am using it too from now on, but each time the ID & Password pops up it ask for his, how can I access mine, so it's my account and financials being used. Thanks to any of those gift

    We both use the same iPad my father and I as of today, as is letting me use it too from now on (sweet! ), I do not want to make a mistake and accidently use my father's ID & passwords (dohh ), but each time the ID & Password pops up it ask for his (???), how can I access mine, so it's my account and financials being used. Thanks to any of those gifted with this knowlegde... AMAKANGAROO

    In order to reliably save the info and be able to restore at a later date, you would need to use his AppleID.
    Switch to it on iTunes, back the iPad up and confirm the backup exists (Preferences / Devices), then switch to yours, wipe the iPad and start afresh. Will also wipe his apps, as they are tied to the AppleID as well.

  • How do you set a defalut theme(in this case, the theme is HiFi) so each time the computer starts, you do not to have to constantly change it??

    How do you set a default theme(in this case, the theme is HiFi) so each time the computer starts, you do not to have to constantly change it??

    for some reason the function never get's called. I have this
    MyComboBox.dropdown.addEventListener(ToolTipEvent.TOOL_TIP_SHOW,
    myListener);
    and ive tried this:
    MyComboBox.addEventListener(ToolTipEvent.TOOL_TIP_SHOW,
    myListener);
    private function myListener (e:ToolTipEvent) : void {
    trace("e: " + e.target);
    trace("e: " + e.toolTip);
    Any more ideas?

  • Jafa log file is suplicated each time the process is run

    Hi all,
    I am trying to create a file logger,,Following is part of my coding.
    Now I can see the log file being created. However my problem is that every time I run the process the log is appended to the test.log file correctly. But the problem is that it also create test.log.1, test.log.2.. etc files each time the process is run. It will be great if anyone advise me how to eleminate these extra files being generated each time. I need just one log file to be genereted and all the logs to be appended to it.
    boolean append = true;
    FileHandler handler = new FileHandler(test.log);
    SimpleFormatter simpleFormatter = new SimpleFormatter();
    handler.setFormatter(simpleFormatter);
    logger.addHandler(handler);Thanks in adavance

    Are you saying that it is creating new logs AND appending to the other one? That doesn't seem quite right.

  • When using iPhone with Ford automobiles' Sync, the connection drops each time the ignition is shut off. In order to restore, the bluetooth must be turned off on the iphone, then restarted. Any suggestions?

    When using iPhone with Ford Automobiles' SYNC, the connection drops each time the ignition is shut off. To restore, you must turn off the bluetooth on iPhone, then restart each time. Any suggestions?

    There is an update avaialbe for Ford systems to correct bluetooth problems. You need to update your system.

  • HT201210 hi,am trying to restore my ipod but i am getting this message each time:the ipod could not be restored-an unknown error occured,what should i do?

    hi,am trying to restore my ipod but i am getting this message each time:the ipod could not be restored-an unknown error occured,what should i do?

    Was the complete wording of the error message? Usually an error number or other information is also provided

  • Best Lyrics cannot be permanently removed. It must have installed a hidden file that creates the add on each time the computer is booted.

    I inadvertently allowed the Best Lyrics add on to be installed for Firefox. It has annoying adds and sometimes links to malicious software. It can be disabled or removed from a session and become non functional after a Firefox restart but each time the computer is booted up it appears again. I assume there must be a file hidden somewhere that re-installs the add on each time the computer is started up. Does any one know how to remove this permanently?

    Thanks for the tip. It rurns out that the Bestlyrics was actually added as a program and I was able to get rid of it by uninstalling it from the control panel. (Should of thought of this before). I downloaded and ran Malwarebytes and it did find a couple of other PUP items for adware that I deleted. Thanks for the tip.

  • HT4972 I attempted to install the iOS 5 software onto my iPhone 4 several times a few months ago. Each time the download timed out at about 3.75 hours. Any suggestions on how to complete the update?

    I attempted to install the iOS 5 software onto my iPhone 4 several times a few months ago. Each time the download timed out at about 3.75 hours. Any suggestions on how to complete the update?

    See... Updating to iOS 5
    http://support.apple.com/kb/HT4972
    If you are using windows...
    Temporarily disable your firewall and antivirus software and try again...
    See here for Connection Issues
    http://support.apple.com/kb/TS1379
    From Here
    http://www.apple.com/support/itunes/troubleshooting/

Maybe you are looking for

  • Logical Component for HANA DB system

    Hi Friends, I am doing Managed System Configuration for HANA DB system. I have created Logical Component for the same, but I am unable to put it in Solution(in SMSY). Can some one suggest. Thanks & Regards, Solman Starter

  • Inventory cube compression

    Hi We are live with Inventory cube filling and delta of material movements, for past 1 year, However we had not automated compression of cube with marker update, What are the steps to automate rollup & compression of inventory cube, is this recommend

  • Having Trouble accessing Adobe website

    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.htm l The website is frequently inaccessable on our corporate network. While monitoring network traffic there was no indication of any traffic being blocked howeve

  • Sample RFID based Project using SAP XI

    Hello everybody, Can anybody send me a RFID based project that can be implemented using XI? I searched in sdn and Google, but didn't come across any. Appreciate your help. Thank you, Deepak.

  • Working with arraylists in JavaScript????

    I am getting a script error while trying to use an ArrayList inside a JavaScript method. How will i store the list???.My code is as follows : obj1[<c:out value="${count.count}"/>]=<c:out value="${formids.excludeList}"/> where 'excludeList' is an arra