Is there an easier or neater way to code this...

Hi there,
just another quickie...
Is there an easier way to write the following code
(especially if i'm going to have a lot of these types of "if"
statements that might need to be edited down the track)?
Thanks in advance

No, whatever you are trying to accomplish there, no! It's
several accidents waiting to do nothing. Try this...
_global.gStrCost = 0;
var gSCArray = new Array("0","1","5","10","20","30","50");
this.onEnterFrame = function(){
_global.gStrCost = gSCArray[Number(myStrTxt.text)];
The "Number(...)" part of that is a function converting the
text to a number.
If that line hanging in space...
myFinalCostTxt.text = gStrCost;
is ultimately what you want out of that, then your
onEnterFrame function could be revised to be...
this.onEnterFrame = function(){
myFinalCostTxt.text = gSCArray[Number(myStrTxt.text)]; //
since gSCArray holds string values
_global.gStrCost = Number(myFinalCostTxt.text);
}

Similar Messages

  • I forgot my security password and didn't set up a rescue email address. I tried calling apple but they tried charging me to reset the questions. Is there an easier and cheaper way to reset them?

    I forgot my security password and didn't set up a rescue email address. I tried calling apple but they tried charging me to reset the questions. Is there an easier and cheaper way to reset them?

    Probably not; if you want, you can try using this form, but will likely be told to phone instead.
    (100460)

  • ITunes accepted my de-authorize request but didn't reset. Now when I check it it says I have to wait till June 26th? There has to b a way to reset this! I can't wait to access my Cloud svcs etc for 2 months!

    iTunes accepted my de-authorize request but didn't reset. Now when I check it it says I have to wait till June 26th? There has to b a way to reset this! I can't wait to access my Cloud svcs etc for 2 months!

    That means you had already done de-authorization once last Jun26. Please take note that you are only allowed to deauthorize all only once a year. Refer to this article:
    iTunes Store: About authorization and deauthorization
    http://support.apple.com/kb/HT1420
    However, you may contact Apple Customer service for exception to the rule. Scroll down to bottom of this page and click Contact Us link. Go to Phone section for Phone number of your country and call them.

  • There has to be some way to do this...

    I have a series of tests that are flash movies running in a
    browser. We cannot allow the testee to refresh the browser by
    hitting the f5 button. Is there any way to capture this key and
    prevent it from being passed to the browser window?

    "MichaelBlum" <[email protected]> wrote in
    message
    news:ea8kad$esr$[email protected]..
    >I have a series of tests that are flash movies running in
    a browser. We
    >cannot
    > allow the testee to refresh the browser by hitting the
    f5 button. Is
    > there any
    > way to capture this key and prevent it from being passed
    to the browser
    > window?
    >
    No.
    What you can do is use a sharedObject to save data based on
    what the user
    has done thus far. Then, the first thing your movie would do
    is check the
    data in the sharedObject and determine where to go to start.
    You could also do something server side with a script that
    takes an IP
    address and location variable as arguments. The script could
    then update a
    database with the same data. Now your first thing in your
    movie would be to
    look up the data based on the IP address.

  • Is there an easier/more-automated way to create user settings in Profile Manager?

    I'm setting up a Mavericks Server and am setting up the settings for each user within the Profile Manager. I'm finding somewhat tedious to have to enter all of the server and account information per service per user. Seeing that it knows the details of the server it's running on – and the user for whom I'm setting up the profiles, is there no automatic way to produce a settings bundle for each user? At the very least, the server hostname and username should be prefilled.

    What settings are you setting in the profiles? You can set a general setting that is available to all users, and also create various device configurations and add devices to them. I personally have not found much use for user specific profiles within profile management.   

  • Is there an easy and safe way to install Flash Player?

    I am getting this notice trying to down load from the updater on Windows 7 Home Premiu.
    "Installation encountered errors
    Actionlist not found"
    Do I need to hire someone to download Adobe Flash, because I am not good at this.
    thanks

    Download and run the offline installers from http://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html#mai n-pars_header (under the heading Progress bar hangs...).

  • Callouts and anchored objects - there must be a better way to do this

    I've spent a lot of time in the last six months rebuilding PDF files in InDesign. It's part of my ordinary responsibilities, but I'm doing a lot more of it for some reason. Because I'm sending the text of these rebuild documents out for translation, I like to keep all of the text in a single story. It really helps to have the text in "logical order," I think; when I'm prepping a trifold brochure, I try pretty hard to make sure that the order in which the readers will read the text is duplicated in the flow of the story throughout the ID document.
    So, I'm rebuilding a manual that has a 3-column format on lettersize paper, and it's full of callouts. Chock full of 'em. They're not pull quotes, either; each of these things has unique text. Keeping in mind that I'd like the text in these callouts to remain in the same position in the text once I've linked all the stories and exported an RTF for translation, what's the best way to handle them? What I've been doing is inserting an emptly stroked frame as an anchored object, sized and positioned to sit above the text that is supposed to be called out. When my translations come back, they're always longer than the source document, so as I crawl through the text, I resize the anchored frames to match the size and position of the newly expanded translated text, and then nudge them into place with the keyboard.
    There Has To Be a Better Way.
    There is a better way, right? I'm not actually too sure. If I want to actually fill those anchored frames with text, I can't thread them into the story. I suppose that I could just thread the callout frames and assign two RTFs for translation instead of one, but then the "logical order" of my text is thrown out the window. So, I'm down to asking myself "what's more important? reduction of formatting time or maintenance of the flow of the story?" If there's something I'm missing that would let me dodge this decision, I'd love to hear about it. The only thing I can think of would work like this:
    1) Duplicate callout text in the story with a custom swatch "Invisible"
    2) Create "CalloutText" parastyle with "Invisible" swatch and apply it to callout text
    3) Insert anchor for anchored frame immediately before the CalloutText content
    4) Send it out for translation
    5) While I'm waiting for it to come back, write a script that would (dunno if this is possible):
       a) Step through the main story looking for any instance of CalloutText
       b) Copy one continguous instance of that style to the clipboard
       c) Look back in the story for the first anchor preceeding the instance of CalloutText
       d) Fill the anchored object with the text from the clipboard (this is where I'm really clueless)
       e) Apply a new parastyle to the text in the callout
       f) Continue stepping through the story looking for further instances of CalloutText
    If this really is the only decent solution, I'll just head over to the Scripting forum for some help with d). Can any of you make other suggestions?

    In-Tools.com wrote:
    The use of Side Heads saves weeks of manual labor.
    Yup, Harbs, that is exactly what I was describing. If I use the Side Heads plugin to set up a job, will my clients get a missing plug-in warning when they open up the INDD? Will roundtripping through INX strip the plugin but leave the text in the callout? (My clients don't care if the logical flow of the story is broken; it's just me.)
    I'm just curious; seems like a pretty obvious purchase to me. I'll probably try to script a solution anyways, after I buy the plugin; that way I get to learn about handling anchored objects in scripts AND deliver the job on time!

  • Is there an APP or a way to do this on the iPhone?

    On the old PDA we used to be able to just point our PDA at another one and jusr zap over our information like Number and address for them to store can we do this on the iphone?

    There are some apps, but they don't send via IR or bluetooth as your PDA used to - they currently use e-mail. Haven't tried any of these (I'm trying to decide if I need it) but here are a few: Send Contact, GoContact, v-Card Mailer, EmailContact.

  • When a link is rolled over by the mouse pointer a very annoying pop up with the link address shows up. There seems to be no way to prevent this from happening. How can this pop up be made to go away?

    no matter what website, every time I move the mouse pointer over something to click on a line of black printing in a thin white box pops up at the bottom of the screen and shows me the http address of the item I'm about to click on. I want to shut this function off or remove it if possible. I find that the previous version did not do this, it seems to be unique to 6.0. It's VERY distracting and ANNOYING. How can I make it go away????

    When you hover the mouse cursor over any link, it will display the link details at the bottom left of the screen; black font on white background.
    This display can be very important as it shows the full address of the hyperlink. This can be particulary useful for checking on whether the link is bona-fida. For example; if you receive an email that looks like it is from a bank , hovering over the link will indicate instantly that the link is pretending to be something it isn't.
    Another example that can be useful; a website link may say 'contact me' rather than give the actual email address. However, when you hover over the link, the actual email address will be displayed at the bottom of the screen. If you click on the link then Outlook usually opens, however I do not use Outlook, so displaying the email address is useful.
    This display is something that has always been present and it is also displayed if you use IE.
    However, I can see that this annoys you, so you could try the following:
    [[https://addons.mozilla.org/en-US/firefox/addon/link-location-bar/?src=api]]
    After installing the addon, you will need to restart Firefox, then go to History and Restore previous session to get all your tabs and webpages back.
    You will now find that when you hover over any link, it will now display in your address bar on the right hand side.
    If this helps, please say this question has been solved.

  • Installed Time Capsule, now want to delete/clean files from mac mini HD, is there an easy way to do this?

    I've installed Time Capsule and using Time Machine backed up all my files from my Mac Mini (mid 2010) and verified they're there, now, as nervous as I am to do this, I want to clean/delete all the files on my mac mini hard drive, is there an easier and faster way than just moving to trash and deleting them? Looks like that can take hours.
    My intention is to use the Time Capsule as a Hard drive so I can clean my Mac Mini hd since it was reaching capacity.
    Thanks!

    Ok, I just googled how to format my external hard drive to Mac OS extended (Journaled), no problem, understood.
    Bear with me, I'm not too computer savvy, then connect to my mac mini, copy all my files to that ext. hd, then in system pref for the TC don't add to exclude?
    I don't think I want to keep that also permanently connected to TC as then I'm backing two hardrives?

  • Is there a neater way of referencing these picture boxes?

    I am doing an assignment and I need to setup an array to contain picture boxes, I have managed to do so but it looks incredibly messy and there must be a better way of doing this. 
    this.arrEnemiesForm = new PictureBox[3];
    this.arrEnemiesPanel = new PictureBox[13];
    this.arrEnemiesPanel[0] = this.picBigAlien1;
    this.arrEnemiesPanel[1] = this.picBigAlien2;
    this.arrEnemiesPanel[2] = this.picBigAlien3;
    this.arrEnemiesPanel[3] = this.picBigAlien4;
    this.arrEnemiesPanel[4] = this.picBigAlien5;
    this.arrEnemiesPanel[5] = this.picBigAlien6;
    this.arrEnemiesPanel[6] = this.picBigAlien7;
    this.arrEnemiesPanel[7] = this.picBigAlien8;
    this.arrEnemiesPanel[8] = this.picBigAlien9;
    this.arrEnemiesPanel[9] = this.picBigAlien10;
    this.arrEnemiesPanel[10] = this.picBigAlien11;
    this.arrEnemiesPanel[11] = this.picBigAlien12;
    Any help would be appreciated.

    this.arrEnemiesPanel = new PictureBox[] {
    picBigAlien1, picBigAlien2, picBigAlien3, picBigAlien4, picBigAlien5, picBigAlien6,
    picBigAlien7, picBigAlien8, picBigAlien9, picBigAlien10, picBigAlien11, picBigAlien11
    Armin

  • HT4009 I'm in Subscription **** on the iPad.  Is there an App or faster way to determine current Magazine subscriptions?

    How can I easily be sure I don't already have a magazine subscription or a single issue in Newsstand (or Zinio) when confronted with a purchase option. Is there an App or faster way to determine this information?  Both Newsstand and Zenio have seen fit to "hide" this data deep in another App or menu, perhaps as a marketing tool to get you to buy multiple copies of the same magazine.  I travel for a living and buy and delete digital magazine all the time.  Sometimes, I buy them and am unable to download immediately due to slow WiFi or restrictions in airports, this adds to the confusion as what I have bought, deleted, or never downloaded, especially with multiple readers.  Additionally, the App store manages current subscriptions on one menu and single purchases in another.    I love reading on the new iPad, but the management of subscriptions has been an absolute nightmare.   Is there another Newstand App that is easier to use or perhaps a Subscription Management App?     

    Take a look here:
    http://support.apple.com/kb/HT4098
    Other than looking in the various locations or doing a search for the title, I don't know of any way to easily find single-issue purchases.
    Regards.

  • There needs to be a way TO TURN OFF this audio-killing feature.

    I've written in Apple's suggestion form several times during the past two and a half years, but iChat seems quiet forgotten since Leopard. So now I'm wondering if there's a hack-like way to fix this.
    My girlfriend and I are in a long-distance relationship.
    I live with a roomate on a 11quartermaster who can be quiet noisy. She lives in a family-packed home.
    iChat has a tendency to gradually mute the other person if loud audio is coming from one side. This feature is useless. Skype doesn't do it, and we always have clearer audio. But Skype has far less features, iChat theater for watching films and sharing music and pictures with one another. Screensharing for giving techsupport, group video for free (How the &%#€ does Skype charge for P2P chat anyway?)
    So, is there any way to disable this "Smart" audio leveling/normalizing feature? Oh and while I'm at it, is there a way to make calls autoresume if connection is lost? A session can easily last 3 hours, sometimes 6+, saying something for a long time, thinking you can be heard only to find out it's saying that there was no connection for 10 seconds, is quiet frustrating when it happens several times a day, every day of the year.
    Thanks in advance! Willing to use any terminal-based fixes!
    What we did to troubleshoot: Turn off and on the "recude ambient noise" in sound settings, as well as both using headphones. I asume the feature is to stop feedback, but feedback is impassible with headphones (As long as they are volumed responibly)

    Hi,
    On the sound front you seemed to have tried most things.
    From the way you started I was thnking of Headsets but I se you have tried them as well.
    I generally keep my Volume on my computer fairly low.
    I then use this AppleScript that is linked in the iChat Video Invites in the Alerts section of the Preferences so it is auto Triggered.
    using terms from application "iChat"
        on av chat started
            set status to away
            set status message to "In Conference . . ."
            delay 0.2
            set volume input volume 85
            delay 0.2
            set volume output volume 80
            delay 0.2
        end av chat started
    end using terms from
    The First bit just make me look "Busy" both by turning the Away marker (Red) On and by the Message.
    The Second bumps bother trhe Input Volume (The one set in System Preferences > Sound > Input) and the Output Volume.
    You could take the second part of this and set it in a loop to keep resetting the volume every few seconds.
    9:27 PM      Monday; October 31, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Updating 3GS from 3.1.2 to 6.1.3 taking way too long. Is there a better and faster way?

    How long does it take to update an original 3GS to 6.1.3? I followed the iTune instructions and it has been updating for hours already. Is there a better and faster way to do this?

    SO if I want to represent the London Underground
    network as a Graph how would I be able to do it?By writing classes of your own or using some one else's. I don't think that the collections framework has out-of-the-box support for graphs.... So try google first.
    The implementation details depend on the API you are going to use, of course...
    from A to B 5 min
    from B to C 4 min
    from A to C 9 min
    this information is redundant, the third info should be omitted. <nit-picking>
    No it's not - What if there's a special, more direct route from A to C? Also, getting from A to B to C will usually take more time than the time from A to B plus the time from B to C. The trains have to stop at B, don't they?
    </nit-picking>
    Maybe this approach is more complex, but it solves the problem Have I understood correctly - isn't what you describe just another way to implement a graph?

  • Is there a better way of doing this? (multifileupload/forms/mysql)

    Hi all.
    I've managed to cobble together a page that will let me upload three files paths and three text boxes to a mysql database. the the files also go to specific directories depending on conditions.
    what im looking for is to see if there is a more efficient way of doing this. im mainly looking at the value and name strings along with the preparedstatement insert. i'd like to see if i can make it more dynamic so i don't have to predefine an amount anywhere.
    This code is working as is if anyone wants to use it in it's current state.
    here is the form
    <HTML>
      <HEAD>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"/>
        <TITLE>File Upload Page</TITLE>
      </HEAD>
      <BODY>Upload Files
        <FORM name="filesForm" action="uploadTestProccess.jsp" method="POST" enctype="multipart/form-data">
            File 1:<input type="file" name="file1"/><br/>
                File 2:<input type="file" name="file2"/><br/>
            File 3:<input type="file" name="file3"/><br/>
              text4: <input type="text" name="textField4" value="this is a test4"><br>
              text5: <input type="text" name="textField5" value="this is a test5"><br>
              text6: <input type="text" name="textField6" value="this is a test6"><br>
            <input type="submit" name="submit" value="Upload Files"/>
        </FORM>
      </BODY>
    </HTML>and here is the insert
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="org.apache.commons.fileupload.DiskFileUpload"%>
    <%@ page import="org.apache.commons.fileupload.FileItem"%>
    <%@ page import="org.apache.commons.fileupload.*"%>
    <%@ page import="java.util.List"%>
    <%@ page import="java.util.Iterator"%>
    <%@ page import="java.io.File"%>
    <%@ page import="java.sql.*"%>
    <%!
    String value4;
    String value5;
    String value6;
    String name1;
    String name2;
    String name3;
    String dir;
    Connection dbconn;
    ResultSet result;
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    </head>
    <%
            //System.out.println("Content Type ="+request.getContentType());
            DiskFileUpload fu = new DiskFileUpload();
            // If file size exceeds, a FileUploadException will be thrown
            fu.setSizeMax(10000000);
            List fileItems = fu.parseRequest(request);
            Iterator itr = fileItems.iterator();
         for(int i=1; itr.hasNext(); i++){
                FileItem fi = (FileItem)itr.next();
                //Check if not form field so as to only handle the file inputs
                //else condition handles the submit button input
              if(!fi.isFormField()) {
                  out.print(i);
                //out.println("\nNAME: "+fi.getName());
                //out.println("SIZE: "+fi.getSize());
                   if(i==1){
                        name1 = fi.getName();
                        dir = "file1/";
                   } else if (i==2){
                        name2 = fi.getName();
                        dir = "file2/";
                   } else {
                        name3 = fi.getName();
                        dir = "file3/";
                File fNew= new File(application.getRealPath("examples1/" + dir), fi.getName());
                //out.println(fNew.getAbsolutePath());
                fi.write(fNew);
                   out.print("success<br>" + fi.getName() + "<br>");
                  } else {
                     //gets field names and values
                  // out.println("Field ="+fi.getFieldName());
                     String name      = fi.getFieldName();
                   if(i==4){
                        value4 = fi.getString();
                   } else if (i==5){
                        value5 = fi.getString();
                   } else if (i==6) {
                        value6 = fi.getString();
                   String value = fi.getString();
                    out.println("Found field with name <b>"+ name +"</b> and value <b>"+ value  +"</b><br>");
                   Class.forName("org.gjt.mm.mysql.Driver");
                   dbconn = DriverManager.getConnection("jdbc:mysql://localhost:3306/xxx?user=root&password=xxx");
                   PreparedStatement sql = dbconn.prepareStatement("INSERT INTO uploadtest (file1, file2, file3, four, five, six) VALUES (?,?,?,?,?,?)");
                   sql.setString(1, name1);
                   sql.setString(2, name2);
                   sql.setString(3, name3);
                   sql.setString(4, value4);
                   sql.setString(5, value5);
                   sql.setString(6, value6);
                   int result = sql.executeUpdate();
              %>
    <body>
    <!--Upload Successful!!-->
    </body>
    </html>

    anyone?

Maybe you are looking for