Is there a better system for this?

Hi, I have a cheat code system for my game and now this is the code:

on (press) {
     var thingy:Boolean = false;
}
on (release) {
     if (_root.mf.codes == twoly) {
          _root.twolock = false;
          this.thingy = true;
     } else {
          if (_root.mf.codes == twreee) {
               _root.twolock = false;
               _root.threelock = false;
               this.thingy = true;
          } else {
               if (_root.mf.codes == fourt) {
                    _root.twolock = false;
                    _root.threelock = false;
                    _root.fourlock = false;
                    this.thingy = true;
               } else {
                    if (_root.mf.codes == five5) {
                         _root.twolock = false;
                         _root.threelock = false;
                         _root.fourlock = false;
                         _root.fivelock = false;
                         this.thingy = true;
                    } else {
                         if (_root.mf.codes == toosixy) {
                              _root.twolock = false;
                              _root.threelock = false;
                              _root.fourlock = false;
                              _root.fivelock = false;
                              _root.sixlock = false;
                              this.thingy = true;
                         } else {
                              if (_root.mf.codes == sevenyearsyoung) {
                                   _root.twolock = false;
                                   _root.threelock = false;
                                   _root.fourlock = false;
                                   _root.fivelock = false;
                                   _root.sixlock = false;
                                   _root.sevenlock = false;
                                   this.thingy = true;
                              } else {
                                   if (_root.mf.codes == eight1) {
                                        _root.twolock = false;
                                        _root.threelock = false;
                                        _root.fourlock = false;
                                        _root.fivelock = false;
                                        _root.sixlock = false;
                                        _root.sevenlock = false;
                                        _root.eightlock = false;
                                        this.thingy = true;
                                   } else {
                                        if (_root.mf.codes == ninet) {
                                             _root.twolock = false;
                                             _root.threelock = false;
                                             _root.fourlock = false;
                                             _root.fivelock = false;
                                             _root.sixlock = false;
                                             _root.sevenlock = false;
                                             _root.eightlock = false;
                                             _root.ninelock = false;
                                             this.thingy = true;
                                        } else {
                                             if (_root.mf.codes == tendyone) {
                                                  _root.twolock = false;
                                                  _root.threelock = false;
                                                  _root.fourlock = false;
                                                  _root.fivelock = false;
                                                  _root.sixlock = false;
                                                  _root.sevenlock = false;
                                                  _root.eightlock = false;
                                                  _root.ninelock = false;
                                                  _root.tenlock = false;
                                                  this.thingy = true;
                                             } else {
                                                  if (_root.mf.codes == unlockable) {
                                                       _root.twolock = false;
                                                       _root.threelock = false;
                                                       _root.fourlock = false;
                                                       _root.fivelock = false;
                                                       _root.sixlock = false;
                                                       _root.sevenlock = false;
                                                       _root.eightlock = false;
                                                       _root.ninelock = false;
                                                       _root.tenlock = false;
                                                       _root.Locked = false;
                                                       this.thingy = true;
                                                  } else {
                                                       this.thingy = false;
                                                  }
                                             }
                                        }
                                   }
                              }
                         }
                    }
               }
          }
     }
     if (this.thingy == true) {
          _root.txtx = "It worked";
     }
     if (this.thingy == false) {
          _root.txtx = "Wrong code";
     }
}

I wonder if there is a way to make it more condense or not.

II think this should do the trick.

var codes = [twoly, twreee, fourt, five5, toosixy, sevenyearsyoung, eight1, nine1, tendyone, unlockable];
var lock = ['twolock', 'threelock', 'fourlock', 'fivelock', 'sixlock', 'sevenlock', 'eightlock', 'ninelock', 'tenlock', 'Locked'];
var thingy = false;
for(var i=0;i<=9;i++){
 if(_root.mf.codes == codes[i]){
  for(var j=0;j<=i;j++){
   _root[lock[j]] = false;
  }
  this.thingy = true;
  break;
 }
}
_root.txtx = this.thingy ? "It worked" : "Wrong code";

In the future, I want to stay away from these variable names. For this kind of thing, I think it would be easier to manage a table 'lock', using lock [0] lock [9] instead of twolock by locked and even a table for codes I did.

Instead of asking someone compress your code, it would be more useful to describe what the code does. What I'm guessing that the purpose of this code is, is to check a code and then unlock all levels earlier, followed by a confirmation that he was indeed a code valid.

Tags: Adobe Animate

Similar Questions

  • The mouse does not says "there is no driver for this mouse.

    Original title: Retractable Belkin Mini travel mouse

    All of a sudden my mouse has stop working.  It is said that there is no driver for this mouse.  I used it for about a year.  There isn't any software mouse in particular.  I don't know what could have changed.

    Hi Wandajenkins,

    1 did you do changes on the computer before the show?

    2. what operating system is installed on the computer?

    Follow the suggestions below for a possible solution:

    Method 1: You can run the Microsoft Fixit and see if that does the trick.

     

    Hardware devices do not work or are not detected in Windows

    http://support.Microsoft.com/mats/hardware_device_problems/en-us

    Method 2: As it was working fine until you can complete the restore of the system and check if the device works very well.

    What is system restore?

    http://Windows.Microsoft.com/en-us/Windows7/what-is-system-restore

     

    System Restore: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/system-restore-frequently-asked-questions

    You can also contact Belkin Support for assistance on the issue:

    Contact Belkin

    http://www.Belkin.com/au/contactus/index.asp

    Let us know if that helps.

  • There is no function for this responsibility-R12

    Hello

    I hv created a user...
    I assigned the following resposnsibilty-


    • System administrator
    • System administration
    • Application developer
    • Functional administrator
    • Functional developer
    • User management
    • Great book Super user


    I disconnected & logged in as new user...

    then click User Management - it throws no function is available for this responsibility

    rest works fine.

    work nearby:

    clear the cache...

    still the unsolved problem


    Thank you

    Hello.

    User management roles must be added. Procedure is little different to add.

    Check Metalink note below: -.

    UMX error: "There is no function for this responsibility" or "There is no valid navigations to this responsibility" When Accessing 'Users management' responsibility. [734280.1 ID]

    Thank you
    JD

  • Hi, my places.sqlite file size is 30 720 KB I reached the maximum size, is there a maximum size for this. Visited links are is more changing color.

    Hello
    My places.sqlite file size is 30 720 KB I reached the maximum size, is there a maximum size for this.
    Suddenly the visited links don't change is no longer the font color, that I prepare for an exam, I need visited issues to change color, to follow up on issues that I ended. But if I delete a few days of history, then again once, most visited links change color and then it stops, it seems that something is getting full and not able to accommodate more? Why my visited links don't change color after a number of visits? I would like to make a back up of the file places.sqlite. So I tried everything to remove the profile, uninstalling reinstalling, creating a new profile, and then copy paste places.sqlite etc, but as mentioned after a few visits, visited links is no longer change color, if I delete a few days in history and then a few visits is again change color and then stop again, so what should I increase so that my quota of visited links is increased , I also tried tweaking about: config and there has been no result. Although I was not really convinced that _pages growing brower.history_max (don't remember the name, but I'm sure you get the idea) will help.
    Seems that while my visited links change color, quota is met and only if I delete the history of a few days will I get some links most visited to change color. Can someone enlighten us? As mentioned that my places.sqlite file size is 30 720 KB so I think maybe this has something to do with it? Would be very grateful if someone could help me. Thank you.

    Sorry it is not looking good.

    1. Unlike bookmarks history is not saved in Firefox.
    2. There is a possibility using Windows.
    3. Sync is not expected to back up things until the synchronization server
    4. If places.sqlite does not sort itself you may have to re-create remove it. You will lose your history, but can still access indirectly IF you have saved a copy of the appropriate
    5. Different databases to try to create new profiles
    1. History
      is rather less robust than bookmarks, you should deliberately somehow return it upward, but it's too late now
    2. Earlier versions of Windows
      This is really the last chance. Make sure you have some places.sqlite you saved. Always before and after any attempt to restore the backup. Windows must be able to provide a previous version. One of these versions may be usable as is; or can be used after a repair with housekeeping. Of course, this is not the latest version but it should help.
    3. Sync is not a server backup service.
      Sync is intended to save on another device, no backup is the fact that the second device then contains synchronized information. IIRC Sync development ceased, and the replacement when available may include a server backup option.
    4. Recreate the database of bookmarks (including history)
      Unfortunately, recess can only use saved bookmarks, there is no saved history to use. Once the database is re-created, it will continue to store the history but it loses the existing history. This time take steps to save on a regular basis.
    5. Use the new profiles for database testing.

    To simplify comparison of the results of the database different files create one or more new additional profiles. Then try to smash the places.sqlite file into the test profile with any other places.sqlite, you want to try. Allows you to directly compare the databases, without seeking to use sync and without changing the Firefox profile work unnecessarily. You can keep a reference profile of studies with the best of the profiles of any shows results of history; According to the best recreated or corrupted database is.
    • Use the Profile Manager to create and delete profiles Firefox
    • CARE, do not rename or delete profiles created once or use anything other than empty folders when they are created. Don't nest in the other profiles. (At least until you know exactly how it behaves - post back if you never consider such actions)
  • The use of a third party bought the CD/DVD software (i.e. TurboTax bought on eBay) can cause damage to my MacBook Pro?  If so, is there anyway to check for this?

    The use of third party software bought DVD (i.e. TurboTax bought on eBay) can cause damage to my MacBook Pro?  If so, is there anyway to check for this?

    As it is a pressed original, CD/DVD printing, and not a house in CD - R or DVD-R commercial, there should be essentially no possibility of its containing malware.

  • Why can I no longer right click to get the NewFolder option? I realize now, there is a button for this, but it does not work.

    Why can I no longer right click to get the NewFolder option? I realize now, there is a button for this, but it does not work.

    Hello

    I understand that you are facing problems with the creation of a "New folder" option in the context menu.

    Have you made changes on the computer before this problem?

    I suggest to follow the methods provided below and we update on the State of the question.

    Method 1: I suggest you to follow the steps suggested by "Linda Yan" and check if it helps.
    http://social.technet.Microsoft.com/forums/en-us/w7itproui/thread/9ee6ecdf-5958-4AF4-B640-c659ada57bc4/

    Registry WARNING: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, see this link: http://windows.microsoft.com/en-US/windows7/Back-up-the-registry

    Method 2: If the problem persists, I suggest you follow the steps proposed by "Linda Yan" and check if it helps.
    http://social.technet.Microsoft.com/forums/en-us/w7itprogeneral/thread/97de8a2a-12f2-4381-A409-a78f4ae551cf/
    Hope this information is useful.

  • I have panasonic lumix g6 and cannot open raw with adobe elements 12 files, there is no support for this problem, any suggestions?

    I have panasonic lumix g6 and cannot open raw with adobe elements 12 files, there is no support for this problem, any suggestions?

    Did you check help-> updates to see if they are available? You probably don't have the latest version of Camera Raw that was compatible with Photoshop elements 12 installed.

  • How can I configure my classic workspace, there is no option for this in the menu dropdown.

    I am trying to affect my page of the classic workspace layout, but there is no option for this in the drop down list at the top. I am trying to create an ap div, but it seems that the only way to access the ap div drawing tool is by accessing it through the insert/common/ap div. BUT I CANT GET TO IT!

    The APDiv option is not part of the program since the past 4 or 5 versions.

    To add position: absolute to an item, you must use CSS designer, or manually add the code in your CSS file or

  • Flash Builder or is there a better way for beginners?

    I am a developer of the theme for a few years, but I would like to create a few apps for my PlayBook. I have never developed an application before, so I'll try to know where to start.

    It seems to me that Flash Builder 4.5 would be the best way to create applications, but I don't want to spend money and time to learn if there is a better way to do it. It's $700 ($1000 for me since I would upgrade my CS3 Suite). My question is, if you're a developer, you would recommend Flash Builder or another way to develop applications for future phones QNX PlayBook?

    FlashBuilder is a very good way to start. There are a lot of samples out there, some are intended for the web or desktop, but often use also apply well to mobile devices.

    Flash Builder Standard edition will do you very well, especially if you are a beginner. That costs $250. I think there may be an updated version to students & teachers in some countries, if this applies to you.

  • Is there a beta support for UNIX 2.2 JavaFX applets?

    Hi guys,.

    I would like to test my 2.2 - based Linux JavaFX applet... Y at - it already a beta support for applets in the latest version 2.2 and how can I work?


    Thank you

    There is obviously something created for UNIX 2.2 JavaFX applets, that's why jiras like this:
    http://JavaFX-JIRA.Kenai.com/browse/RT-22922 "Gtk: Crash on exit when you run the JavaFX applet in the browser.

    If there is an accessible jdk early access build which includes javafx for Unix, it would currently be available here:
    http://jdk7.Java.NET/Download.html
    You can try the installation steps in the jira if you were particularly vivid.

    Note This is obviously an unstable element in development.

  • I have a 2012 macbook pro 17 ", which is the newest operating system for this?

    I have a 2012 macbook pro 17 ", which is the newest program operating for this?

    El Capitan

  • I can't use gestures on Firefox, but I can On Explorer is there an add on for this

    I have a Dell Inspiron One 2305 as computer has a touch screen that you can use gestures to Zoom In and Out with two fingers or pinch the Surface of the screen (as an I Phone)... He works on the Explorer browser, but not on Firefox... Y has an Add On for this problem I do not know if it would work on 3.6 since I was 4 now... I prefer not to use the two BrowsersOne for some another for other stuff

    Some actions have been removed in Firefox 4.

    You can restore the zoom feature by changing the related values of downtown on the topic: config page.

    browser.gesture.pinch.in -> cmd_fullZoomReduce
    browser.gesture.pinch.in.shift -> cmd_fullZoomReset
    browser.gesture.pinch.out -> cmd_fullZoomEnlarge
    browser.gesture.pinch.out.shift -> cmd_fullZoomReset
    browser.gesture.pinch.latched -> false
    

    To open the topic: config page, type Subject: config in the address bar (address) and press the 'Enter' key, as you type the url of a Web site to open a Web site.

    If you see a warning then you can confirm that you want to access this page.

  • Error message on C4580: line: 2107; Char: 1 error: there is no connection for this connection ID.

    Code: 0

    URL: res://leframe.dll/preview.js

    It appears more and more often, often on sent by e-mail or web docs. If I answer "Do you want to continue running scripts on this page?" with o or N, nothing happens. I tried to do screen grabs & print photos that result, but still get the same error msg.

    The problem is caused when Windows creates the profile of the printer in the control panel that is not properly it create with drivers.

    We will not completely uninstall all HP software, instead we will remove the corrupted Windows printer profile and reinstall.  Total time for this on an average computer is about 5-10 minutes to repair completely (including rebooting).

    1) navigate Menu start > devices and printers or Start Menu > Control Panel > printers

    (2) select every profile of the printer to the printer with a problem, and then select remove device/printer.

    (3) restart

    4) go to the Start Menu > all programs > HP > insert model # here > adding printer (or Assistant)

    (5) follow the installer prompts to reinstall the printer profile and it recreates the Windows printer.

    (6) test printing google.com (uses very little ink when the test page comes out).

    I would like to know if you have any questions or problems.

    Thank you

    Dan

  • is there any equivalent code for this?

    Hi, I am doing a project on steganography, but I'm stuck on the bitmap byte array conversion.

    There is no problem for the code to run in the desktop. Is there an equivalent code for the following code in BlackBerry JDE (for OS 5)?

    Private byte [] imageToByte (BufferedImage img)
    {
    WritableRaster raster = img.getRaster ();
    DataBufferByte buffer = (DataBufferByte) raster.getDataBuffer ();
    Return buffer.getData ();
    }

    Review Bitmap getARGB (...) method.

    Here are some examples of documentation of Bitmap code form:

    Original image bitmap =...

    int [] argb = new int [original.getWidth () * () original.getHeight];
    original.getARGB (argb, original.getWidth (), 0, 0, 0, original.getWidth (), original.getHeight ());

  • In the first tab (top left), they are flashing - I have a message from someone I don't know. I can't open the message, there is no message for this person in my posts, and I can't open or remove this notice "flashing". It just keeps flashing.

    I clicked on it: nothing...
    I searched my messages: nothing
    I tried Firefox and the web for that person... nothing...
    I closed and reopened my mailbox mailbox: nothing.
    I'm sure it's a spam message, but I deleted the spam, was unavailable and closed on my e-mail (I don't use anyway), I've tried everything I know to get rid of this "flashing" "notice" that "elvianewtond141 sent you a new message." Please help me to turn off this "flashing" review of a message which is 1) not accessible to me. and (2) an I can't open or delete. Thank you.

    This is a regression in FF9 see https://bugzilla.mozilla.org/show_bug.cgi?id=713014 FF9 fails to open a tab (in your webmail account) to view Yahoo chat. That is why the active tab (in Firefox) keeps flashing. In any case, it works very well in beta version of FF10.

Maybe you are looking for

  • Photo stream does not

    I have always relied on the photo stream to sync my Apple and my PC devices. However, since the last updates I does not sync with my PC. Can I synchronize calendar and contacts but not the photo stream. Please help I know several people with the same

  • model at risk for hard drive failure, how to fix this everthing went into the settings

    I need help because my daughters computer had a pop up that says your comp is at risk of hard drive failure and now everything went on his computer. There is nothing in its settings or in the boot sector and now she doesn't have internet and wifi. Th

  • Subtract value of the signal of the current value 2 seconds ago

    Hello I'm relatively new to LabView, but I went through the Forums and google a lot and have not found a solution. I have this problem: I have an analog signal from my USB6009 DAQ of NOR. I want to take the signal I got 2 seconds ago and subtract its

  • Windows Update indicates that the files needed to use this service no longer exist on my computer. How to solve this problem?

    After having problems with my computer at startup, I finally decided to try to use my Windows XP CD to repair my file system; However, it seems that the CDs partically reinstall some older files. Examples: the browser I was using was Internet Explore

  • Brother Setup error

    IS015-GetMiscInfo - 1 this is what I get when I try to install my MFC295CN If I try folder named mfc-295cn so the error turns, in the function 'INTERFACETYPE': cannot create the dialog. Anyone has an idea why I get this? I have fresh install, install