Is an array the best solution for this problem?

Hi there,
I'm working up a demo where a couple of little games would show up in a  panel. There is a main menu that you bounce around to select things (the  games as well as other apps.)
When a single game is running, it takes up the whole panel. When two or  more are running, they run in a "mini" format. Also, when a game is  running, a special "return to game" button appears in the main menu.
This is a click through dog and pony show demo. It's not a production  app, but it has to work well enough to be played around with by internal  clients. So it has to work well.
Right now I have some variables set up like so:
var gameActive:Boolean = false;
var gameDual:Boolean = false;
In my launch game and menu function, I am checking these (and one or two  other) variables to see if I should do things like show a mini version  of the game or show the return to game button. As I add features though,  this is becoming slightly unwieldy.
The key issue is the games. Let's say I have only two. I could make an  array, and then load in the game name when a game is launched. I could  check this array in my functions to see not only if games are launched,  but which game is launched so I can use the full or mini games as  appropriate.
Is this a good approach, or is there a better way? I'm rusty with my  coding and not super comfortable making objects right now. But I could  go that way if it was the best.

there's not much to it.  here are the only 3 things you're likely to need to do with your associative array:
var yourAA:Object={};
function addAAItem(aa:Object,o:DisplayObject){
aa[o.name]=o;
function removeAAItem(aa:Object,o:DisplayObject{
aa[o.name]=null;
function aaLength(aa:Object):int{
var i:int=0;
for(var s:String in aa){
i++;
return i;

Similar Messages

  • TA24002 My 500 GB can't verify nor repair. I have photoshop work that I need to recover. I would like to know which erase option would be the best solution for this problem.

    My 500 GB can't verify nor repair. I have photoshop work that I need to recover. I would like to know what option would be the best solution for this problem?

    You appear to have two issues: 1) a hard drive that is not working properly and 2) files you wish to recover.
    Re 1) you need to answer Kappy's questions.
    Re 2) does the drive load and can you see your photo files? If so can you copy them to another drive?
    Do you not have a backup of the photo files?

  • I have problems in the initiation of the Encore process when opening presents the following error message : "Encore CS6 Cannot Run in Non-Royalty Serialized".... What is the best solution for this problem ?

    Help Me.
    What is the best solution for this problem ?

    Encore is activated when you activate Premiere Pro... so, as Stan asked, how did you install P-Pro?
    Ask for serial number http://forums.adobe.com/thread/1234635 has a FAQ link
    -and a fix for Encore http://forums.adobe.com/thread/1421765?tstart=0 in reply #7
    -plus more Encore http://helpx.adobe.com/encore/kb/cant-write-image-fie-larger1.html

  • I have iphone 5, after upgrading it to iOS7, front is working find unfortunately rear camera became blurred, what is the best way to fix this? Looking forward to the best solution of this problem.

    I have iphone 5, after upgrading it to iOS7, front is working find unfortunately rear camera became blurred, what is the best way to fix this? Looking forward to the best solution of this problem.

    WORKAROUND FOUND ! Download and install "Awesome Camera" app and take a picture with that app. After 1-2 seconds of standby, it will work. Then you can go back to default Camera app which would work again.Please let me know

  • What is the best solution to this problem?

    I have so many solutions in mind right now but i am looking for the best solution if possible. i have the following query
    SELECT one_query.date_required as Month_id,
               nvl(one_query.amount_used, 0) as overalluserhours_A,
                  nvl(second_query.amount_used_b, 0) as overalluserhours_B,
                  nvl((trunc(((second_query.amount_used_b/one_query.amount_used) * 100), 2)), 0) as p_change
    from
                 (select to_char(b1.needed_date,'YYYY-MM') as date_required,
                    SUM(b1.amount_used) as amount_used,
                      b1.type_id as type_id
                        from table_one b1
                         where b1.zone_type like 'NEWYORK%'
                         and b1.type_id = 'CARS'
                        and trunc(b1.needed_date) between to_date('2009-01-01', 'YYYY-MM-DD') and to_date('2009-12-31', 'YYYY-MM-DD')
                              group by to_char(b1.needed_date,'YYYY-MM'), b1.type_id) one_query,
                (select to_char(b2.needed_date, 'YYYY-MM') as date_required,
                                SUM(b2.amount_used) as amount_used_b,
                                       b2.type_id as type_id
                                    from table_one b2
                                       where b2.zone_type like
                                       'CHICAGO%'
                                  and b2.type_id = 'BIKES'
                                   and trunc(b2.needed_date) between to_date('2009-01-01', 'YYYY-MM-DD') and to_date('2009-12-31', 'YYYY-MM-DD')
                                 group by to_char(b2.needed_date, 'YYYY-MM'), b2.type_id)second_query
    where one_query.date_required = second_query.date_required(+);the above query is being used on table_one. The current problem I am having is based on the fact that table_one might sometimes contain data for only chicago and not for newyork. in this case, table_one would look like this
    identification_id         needed_date                   zone_type             type_id                  
    2                             3/22/2006 12:00:00          CHICAGO                BIKES
    3                              2/12/2006 12:00:00         CHICAGO                BIKEShowever though, in other case, it could be the other way around. in this case, table_one will look like this
    identification_id         needed_date                   zone_type             type_id                  
    4                            4/21/2007 12:00:00          NEWYORK                CARS
    5                             1/12/2007 12:00:00         NEWYORK                CARS
    and finally table_one could contain information for both cases. hence, we could have the following situation
    identification_id         needed_date                   zone_type             type_id                  
    6                            6/21/2008 12:00:00          NEWYORK             BIKES
    7                            8/12/2008 12:00:00         CHICAGO               CARSKindly note, my above query is currently being used inside a function. I know I can write so many if statement to handle but the main issue is regarding the fact, i am also using that query in another query which performs so many union all.

    I'm not sure how you're going to parameterize it, how those filters change from call to call, but an idea would be something like this:
    select date_required month_id,
           max(amt_used_chicago_bikes) overalluserhours_A,
           max(amt_used_newyork_cars) overalluserhours_B,
           (max(amt_used_chicago_bikes) / max(amt_used_newyork_cars)) * 100 p_change
      from (select zone_type,
                   to_char(b1.needed_date, 'YYYY-MM') as date_required,
                   b1.type_id as type_id,
                   SUM(case when zone_type like 'CHICAGO%' and type_id = 'BIKES'
                                 then b1.amount_used end) as amt_used_chicago_bikes,
                   SUM(case when zone_type like 'NEWYORK%' and type_id = 'CARS'
                                 then b1.amount_used end) as amt_used_newyork_cars
              from table_one b1
             where trunc(b1.needed_date) between
                   to_date('2009-01-01', 'YYYY-MM-DD') and
                   to_date('2009-12-31', 'YYYY-MM-DD')
             group by b1.zone_type,
                      to_char(b1.needed_date, 'YYYY-MM'),
                      b1.type_id)
    where amt_used_chicago_bikes is not null or amt_used_newyork_cars is not null
    group by date_required;Again, this is not the biggest concern regarding performance and certainly not the best way of doing it. Cracking those 250 lines of SQL and making it optimized would probably be the best way to approach the issue here.

  • Is Structured FM12 the right solution for this problem?

    I've been tasked with solving a tricky problem at my office. Briefly: We've got a technical manual that needs to be printed each time we sell a piece of equipment. Currently, the manual is produced using a combination of MS Access DB and a convoluted Word doc that uses Mail Merge to pull data from the Access DB into the appropriate fields. The DB has a hundred tables or so, and some of the tables are "calculated" values - i.e. the value in the fields is calculated based on values entered in other tables within the DB. The Word doc uses some kind of "if-then-else" logic to determine which tables to use for which fields when building the doc. This whole setup is currently maintained by the engineering, sales, and marketing departments.
    We currently use FM11 (unstructured) in the Technical Writing department, and my boss is asking me to figure out a way to migrate the Access/Word doc described above to a format we can use so we can take ownership of the documentation process for this particular line of equipment. I suspect the variables involved here go way beyond what we can do with conditional text and variables within FM, but I'm wondering if Structured FM (either 11 or 12) is more suited to this project, either by using some sort of conduit between FM and an SQL DB, or directly within FM using conditinal text, variables, or some other organizational function present in either FM11 or FM12.
    Any guidance here would be appreciated. I'm not even sure what questions to ask at this point to get a proper shove in the right direction.

    I love this line: Get that SQL queries into XML directly or into CSV and transform the CSV into XML via XSLT. Reminds me of that bit in "Good Morning, Vietnam" where Robin Williams goes through the routine about the Vice President: "Well, sir, since the VP is such a VIP, shouldn't we keep his ETA on the QT? Otherwise, he might get KIA and then we'd all be on KP." And now, back to work...
    I'm going to try to answer all of the questions above, in order, and add a little info where appropriate.
    TW dept may or may not take over all maintenance of the doc. That's one of the recommendations I'm tasked with providing. My current thinking is, engineering should remain in charge of entering relevant tool data to the data repository, sales should provide TW with a "spec sheet" of what was sold, and TW should then use the specs to "build" the document for customer release.
    Will a DB still be used? Unknown. That seems the best way to catalog and access the data, but I'm open to alternatives if there are any that make sense.
    I am totally unfamiliar with structure, XML, DITA, HTML, etc. Literally 100% of my experience with FM has been in the unstructured workspace. This whole structured FM inquiry was inspired by a blurb in my "Unstructured FrameMaker 11" book (from p474: "If you need to use complex combinations of condition tags, consider setting up a workflow in the structured interface of FrameMaker. Structured documents allow you to create versions based on attributes, which are easier to use and more powerful than expressions.") A quick Google of this blurb didn't turn up much useful information, but this seems to jive with Lynne's input above re: attributes.
    Data is not currently in SQL - it's in Access DB. We can migrate to SQL if necessary - that's one of the answers I'm supposed to be providing.
    The reason this is all currently being done in Word is because that's what the Sales & Engineering departments understand, and currently they're responsible for these docs. I'm sure this started out as a simple, nerdy solution to a small problem - some engineer didn't want to maintain two separate Word docs when he could create a database and then use mail merge to automagically build the same thing. Since then, it's grown to hundreds of tables and thousands of possible permutations.
    We already have FrameMaker installations in the department. If we can do this with FM11, great, but if not, no big deal - boss has already said he wants to move to FM12 as soon as possible. In other words, purchasing software - unless it's something additional needed to make all this work - isn't really a budgetary consideration.
    As mentioned, I have no skills with using FM for any kind of structured project, but I'm willing to learn if it seems like a good solution. Just need to figure out how to proceed.
    Thanks for your input - looking forward to hearing what else you folks have to say.

  • I have a friend trying to update iOS7 using an ipad mini but during the process there is a message failed to update...whats the best solution for this??

    need our help guys...thanks and more power

    Apple's servers are being hammered by everyone and his dog trying to get the update the minute it was released. I'd suggest he/she wait a few hours, or perhaps until tomorrow, and then try again.
    Regards.

  • As i was using my iphone, it suddenly turned off and it wont come back on. what is the best solution for my problem?

    As i was using my iPhone, it suddenly shut off without being shut off by anyone.i tried to turn my iPhone back on several times and nothing has worked. what could be the problem?

    Does it, instead of powering up, show a little battery icon almost empty and a plug icon next to it? In that case it needs recharging to have enough power to start up again. Even if it doesn't, try connecting it to a power source and see what happens. If it doesn't respond there you may need to bring it in for repair.
    -bb

  • SQL Server 2012 - Wat Is The Best Solution For Creating a Read Only Replicated/AlwaysOn Database

    Hi there I was wondering if someone may have a best recommendation for the following requirement I have with regards setting up a third database server for reporting?
    Current Setup
    SQL Server 2012 Enterprise setup at two sites (Site A & Site B).
    Configured to use AlwaysOn Availability groups for HA and DR.
    Installed on Windows 2012 Servers.
    This is all working and failover works fine and no issues. So…
    Requirement
    A third server needs to be added for the purpose of reporting, to be located on another site (Site C) possibly in another domain. This server needs to have a replicated read only copy of the live database from site A or Site B, whichever is in use. The Site
    C reporting database should be as up-to-date to the Site A or Site B database as possible – preferably within a few seconds anyway….
    Solution - What I believe are available to me
    I believe I can use AlwaysOn and create a ReadOnly replica for the Site C. If so do I assume Site C needs to have the Enterprise version of SQL server i.e. to match Site A & Site B?
    Using log shipping which if I am correct means the Site C does not need to be an Enterprise version.
    Any help on the best solution for this would be greatly appreciated.
    Thanks, Steve

    for always on - all nodes should be part of one windows cluster..if there site C is on different domain - I do not think it works.
    Logshipping works --as long as the sql on site C is is same or higher version(sql 2012 or above).  you can only do read only.
    IMHo, if you can make site C in the same domain then, Always is better solution else log shipping
    also, if your database has enterprise level features such as - partitonin, data compression -- you cannot restore the database on lower editions- so you need to have enterprise edition.
    Hope it Helps!!

  • Migrated Aperture 3 upgrade from old Mac Book Pro to new Mac Book Pro.  Can't open Aperture on new machine because I don't have the original serial number for Aperture 2 program originally installed on the old machine.  What is the best solution to this s

    Migrated Aperture 3 upgrade from old Mac Book Pro to new Mac Book Pro.  Can't open Aperture on new machine because I don't have the original serial number for Aperture 2 program originally installed on the old machine.  What is the best solution to this situation

    Call Apple and make a appointment.
    You have 3 months of care and up to 3 years with paid AppleCare, let them handle it and bring everything in.
    Good Luck

  • The BEST solution for gmail on the iPhone

    OK, so after much poking around, I finally figured out the best solution for using gmail on the iPhone: IMAP support.
    While I think Google is still rolling this out to all users, once you get it, USE IT! It basically keeps your mail app synced with gmail, and even supports the use of folders/labels.
    To see if your gmail account is ready for IMAP, go to the settings option in gmail and see if one of the tabs says "Forwarding and POP/IMAP." If you don't have IMAP available on your account yet, it won't say IMAP.
    Here's some links to get you started:
    setting up IMAP for gmail on your iPhone:
    https://mail.google.com/support/bin/answer.py?answer=77702
    how actions in your mail app sync to gmail:
    https://mail.google.com/support/bin/answer.py?answer=77657
    I hope this helps out everyone as much as it's helped me. I was a little frustrated before using POP, but gotta love IMAP! I'm not too sure the impact that this has on your battery life, but so far it's working well for me. Enjoy!

    Gmail and IMAP have totally change my tune about the iPhone's email abilities. I was getting frustrated with the inability to reliably get mail (Message has not been downloaded...), sync (have to delete mail from both iPhone and desktop Mac), etc., but now I have all my POP email accounts automatically forward to my Gmail account, and I only check Gmail with the iPhone and MacPro. So far, it's a whole new iPhone experience! No more errors - ALL mail comes through perfectly - and no need to manually sync!
    Note that, when setting up the Gmail/IMAP accounts, do NOT simply update your old POP Gmail settings on your Mac or iPhone! Start with a FRESH new account. I couldn't get either the iPhone or Mac to work until I started with a fresh account.
    Also, I was unable to send mail from the iPhone using the smtp.gmail address, so I had changed the outgoing mail setting to use my regular ISP's smtp address. But, at some point (a few minutes later or a few hours, I don't know) when I checked the Gmail settings on the iPhone, it had magically changed itself to smtp.gmail, with the port number, and it has been working perfectly ever since! Maybe IMAP can atomatically correct this info? Not sure.
    One more thing. Once you have Gmail IMAP working, then you MUST go here:
    http://5thirtyone.com/archives/862
    Follow these directions exactly. This is a necessary set of steps in order to make your iPhone and Mac sync correctly, so that trashed mail on the iPhone will go in the trash on your desktop Mac, etc. It's pretty freaky to check email on the iPhone, and then go to your Mac Mail a few minutes later, and see all the newly trashed (or saved/read) emails perfectly synched up!
    A final note. Once this is all working and synching, remember that if you delete an email on your iPhone, it gets deleted on the desktop Mac Mail as well (and vice-versa)... which is exactly what you want to happen, but I find that I have to remember to keep the mail that I want to save on the iPhone's inbox until I get back to my desktop Mac. Otherwise, I have to manually remove it from the trash to save it!

  • What is the best solution for running windows based programs

    I have one program that I need windows for.  What is the best solution for doing this without painfully slowing down my mac.

    Depends on your needs.
    BootCamp requires reboot and uses all physical resources of the system.  Only OSX *or* Windows can run.  Better for gaming or memory intensive tasks.  BootCampAssistant must set up the boot sector to make it work.  Also BCA required to remove it.
    VM (virtual machine) like Parallels which "hosts" Windows while still running OSX.  You split RAM between the two environments.  VM is just another program so no special boot sector changes needed, but not good for graphics or RAM intensive programs.
    Other recommended alternates to Parallels (paid) are VM Fusion (paid) and VirtualBox (free download from Oracle.com).

  • I bought my iphone 5 in Houston Texas May 15 2013 IMEI Nr. 013428009645399.The problem is that in the Greece the country which I live the 4G is not working.If you have any solution for this problem pls. let me know.My email is philcoueth@yahoo.gr Thank yo

    I bought my iphone 5 in Houston on May 15 2013.
    IMEI 013428009645399.The problem I have is that in the country
    which I live GREECE the 4G is
    not working.Please if you have any solution for this
    problem let me know.My email is [email protected]
    Thanking you in advance
    Philip Couridis

    iPhones purchased in the US are NOT guaranteed to work with 4G bands outside of North America.
    For what crazy reason did you purchase an iPhone in the US if you live in Greece?  If your phone needs servicing, it will have to be brought back to the US.  You cannot get that phone serviced in Greece.

  • What is the best solution for me to run Microsoft Access on my brand new iMAC?  Assume I'm a casual user.

    What is the best solution for me to run Microsoft Access on my brand new iMAC?  Assume I'm a casual user.
    I am lead to believe by some real smart guys on the Apple site that If I have the Apple Store partition my iMAC and add the full suite of Office products on that partition, I can run the few Access programs I have and need to run.
    Comments encouraged.  Thank you in advance for your consideration and help.

    You would have to install Windows, then install Microsoft Office Professional for Windows on it  To install Windows you will have to choose between Boot Camp (faster, free) and a Virtual Machine (simpler, slower, easier to backup)
    You should try LibreOffice (free), it can open Access files, it may not have all Access's feature set though, worth a try.
    www.libreoffice.org

  • What’s the best practice for this scenario?

    Hi,
    My users want the ability to change the WHERE and/or ORDER BY clause at runtime. They may define user preferences on each screen ( which is bind to a view object). They want to see the same records based on WHERE/ORDER BY defined on the last visit. That is why I keep the users preferences and load the screen based on that, using :
    View.setWhereClause(...);
    View.setOrderByClause(...);
    View.executeQuery();
    This works good when only one user working with the application but faced low performance when more than one user working with the application.
    What are the points to increase the performance and what is the best practice for this scenario?
    Thanks for your help in advance.

    Sung,
    I am talking only about 2 users in my testing. I am sure i missed something but could not recognize that.
    This page is my custom query page including a tag to instantiate app module in stateful mode at the top <jbo:ApplicationModule..> and a tag to instantiate data source <jbo:Datasource...> and release tag at the bottom <jbo:ReleasePageResources..> and some java code in the middle(body). The java code constructed the query statement and then fires the query to set the view object based on the query statement using the above methods.
    So, I am facing very slow performance(speed) when two clients load this page at the same time. Looks like the entire application locks for others when one client load this page and fire the query. i realized the battle neck is where executeQuery() is executing.
    what do you think.
    Thanks in advance for your comments.

Maybe you are looking for