New to AS and stuck on IF statements

I am trying to make a currency converter and Im using IFs to determine the from and to currency and then make the appropriate calculation. So far, I cant get anything to work. Here is the original code that I was using (but didnt work):
               var a:String=String (OriginCurrenyCode.text)
               var b:String=String (DestinationCurrencyCode.text)
               var c:Number=Number (AmountToBeConverted.text)
               if (a == "USD"){
                    if (b == "GBP"){
                         var ab:Number=Number (c*0.60)
                         ConvertedAmount.text = String(ab)
                    else if (b == "EUR"){
                         var ac:Number=Number (c*0.71)
                         ConvertedAmount.text = String(ac)
Obviously there is much more, and the conversion rates arent completely accurate but thats the basis. I've tried every possible change I can think of but have no idea how to make this work.
I am new to Actionscript and dont have any programming experience so any help is much appreciated.
Thanks!!!
Dave

I agree that the switch statement would make the code easier - and perhaps faster as well. But, I personally never use switch statements in any code I write ever. When I first began programming, an experienced programmer told me that switch statements are frowned upon.
Here's why (from wikipedia): "When implemented with fall-through as the default path, switch/case statements are a frequent source of bugs among even experienced programmers, given that, in practice, the "break" is almost always the desired path, but not the default behavior of the switch/case construct (at least in C and Java)."
So, I've always stuck with if, then, else type statements even though they are harder to read and can be more painful to write and have serveral other disadvantages.

Similar Messages

  • New To Scripting and stuck on first task

    thanks

    they have asked me to create a powershell script to run the above daily.....
    Is it possible to do that
    Yes but you need to follow my recommendations.  You need the components installed and you need to learn how to use them.  Each product has its own forum for questions.
    You will learn a lot.  You will need to learn IIS and Cognos at a technical level and not just at the GUI level.
    ¯\_(ツ)_/¯

  • New to Java and stuck on alert ticker issue

    Hi, I'm a newbee so go easy on me. Here's the issue. The company I am interning for monitors its networks using a console called WhatsUp Gold. The program creates alerts to inform of any issues on the network or when thresholds are close to being reached. This is done using some form of Java which I can view by opening the source files. They have asked me to try and create a scrolling ticker that automatically updates in real time along with the WhatsUp program. I have downloaded INSCRO (a ticker creator) but when I try to direct the feed to the URL on WhatsUp, the ticker scrolls the Java script and not the text that I need it to. Any ideas on how to get it to pull the text vs the source file?
    Thanks in advance!

    First, you need to get straight the difference between Java and JavaScript. They're related only by having similar names. If you're doing "View Source" in a web browser, what you're seeing is JavaScript, NOT Java. If this is where your question lies, you need to find a JavaScript forum.

  • Brand New Apple TV and Stuck on Connectivity - Won't Let me Go Back and Re-Enter PW or Setup

    I plugged in my Apple TV and just got past the language selection. Then to wifi - found my network - entered my password, which I suspect I entered incorrect - and I get a message that I can't connect to the internet. I am right at the beginning stage of starting up from factory settings and have not even seen a screen with the set up selection. When I try to go back to see if I can re-enter my password, it won't let me - and keeps using the wrong password. I tried re-setting and it didn't work. Very frustating. Not user friendly at all. Why doesn't set up menu show? This should be easy - and its not.

    When I try to go back to see if I can re-enter my password, it won't let me
    Go back where?  What won't let you?  Does the network menu under settings show you are connected?
    Why doesn't set up menu show?
    The settings menu is always on the main screen.

  • HT201269 my new 5s was stuck in recovery state & now dead

    hi can anyone help me?
    my 5s is stuck in recovery state. Now its gone off it seems and doesnt come on. It's dead.

    You need to upgrade your computer's OS to at least OS X 10.5.8 and use iTunes 10.5.
    With OS X 10.4.11, you cannot upgrade beyond iTunes 9.2.1.
    OS X upgrades from 10.4.XX to 10.5.XX require purchasing a DVD with the new OS.  If your laptop has an intel processor, you can upgrade directly to OS X 10.6 for $29.
    Take your laptop to the store with your new phone and ask them what your best options are.

  • HT3224 I am new to Mac and started transferring data from my PC to my new Macbook Pro.  Connection was lost once I started and now my Pro is stuck on the 'Transferring Information' screen.  How do I get out of this screen to attempt the connection again?

    II am new to Mac and was trying to transfer data from my PC to my new Macbook Pro.  The connection was lost however and now my Pro is stuck on the 'Transferring you nformation' screen.  How do I get out of this screen so I can attempt the connection again?  Is it safe to force shut down of my Mac and will it still prompt me through all the setup process again?

    Welcome to Apple Support Communities
    If your Mac and PC are connected by Ethernet, unplug and plug that cable again. If not, you have to turn off the MacBook by holding the Power button.
    In the next startup, try to transfer your files again. It's important not to interrupt the transfer process, because in most cases, you will stop it and you won't be able to resume it

  • I'm trying to update my daughter's Ipad2 to the new IOS 8 and it's got stuck on the connect to ITunes display.  We don't have a computer to connect it to and it's never been connected to one.  How do I get past this?

    I'm trying to update my daughter's Ipad2 to the new IOS 8 and it's got stuck on the connect to ITunes display.  We don't have a computer to connect it to and it's never been connected to one.  How do I get past this?

    You can try a soft-reset of pressing and holding both the home and sleep buttons for 10 to 15 seconds so that it reboots, but you are likely to get the same screen. If it does then it will need to be connected to a computer's iTunes so that it can be reset back to factory defaults - do you have a friend with a computer with iTunes installed on it, or is there an Apple store nearby that you could try going to (if there is then preferably make a Genius Bar appointment at it, or don't go at a busy time) ?
    Has she been backing up to the cloud ? If she has then she should be able to restore to that. If not then what she can redownload for free from the stores will show in the Purchased tabs in the store apps.

  • TS1702 I just bought a new iphone 5S and once turned on and pushed the button restore from Icloud, I'm stil stuck in this section i can't do anything plus i turned it off and on again and still not working, please provide me with a solution very urgently!

    I just bought a new iphone 5S and once turned on and pushed the button restore from Icloud, I'm stil stuck in this section i can't do anything plus i turned it off and on again and still not working, please provide me with a solution very urgently!!
    Kindly note also that i did not work on this iphone before, i just turned it on and i cannot connect it to the itune and restore it as the itune cannot read the device since i'm not able to reach my home screen, I am stuck in my restoring screen.
    Please help!!!!

    You dont have any data on your phone yet right?
    If you dont connect your device to the computer and
    Press and hold the Sleep/Wake button and the Home button together for at least 15 seconds, until the Apple logo appears.
    after that click okay when it says itunes has detected an iphone in recovery mode. Then click restore
    after that try again

  • Ok, so basically my charger fell apart on my MacBook pro(2010) and I didn't have the money for a new charger, I got it in the states too if that's relevant. Basically my laptop will not charge, I bought a new charger yesterday and it's still no-use

    Ok, so basically my charger fell apart on my MacBook pro(2010) and I didn't have the money for a new charger, I got it in the states too if that's relevant. Basically my laptop will not charge, I bought a new charger yesterday and it's still no-use,not charging . No green or orange light coming on on the new charger either.

    It is one of the items that Apple gets criticized at regular intervals. The MagSafe connector is proprietary and unlicensable, so the company has a lock-in on the power options. And as you have now found out, your hijinks trying to avoid buying an expensive new charger may have caused more damage and led to a total no-charge condition.
    If lucky and no physical damage has occurred (there IS a fuse in there somewhere on the circuit boards), maybe resetting the SMC can restore charge functionality, provided there is still enough juice: http://support.apple.com/kb/HT3964

  • I have a set of 3 USB disk connected to my TC via a USB hud. I usually swithc the TC at night. When I restart the next day it stucks in amber state. when I disconnect the USB hub where my discs connects and restart, it start properly. Any hints?

    I have a set of 3 USB disks connected to my Time capsule (TC) via a USB hub. I usually switch the TC at night. When I restart the next day it stucks in amber state. When I disconnect the USB hub where my discs connects and restart, the TC will start properly. Any hints?

    LOL.. don't switch off the TC.. this is fairly typical behaviour..
    Or try a different usb hub.. but you could well and truly run out of hubs before you fix the problem.
    Are you running latest firmware for your TC?
    What error message is coming up in the airport utility.. amber led is a fault indicator.. look up what the actual fault is and see if it is for instance overloading the usb. You are using a powered hub??
    Get one bigger USB hard disk instead of 3 smaller ones.

  • Why are messages not dequeuing and stuck in the ready state?

    Messages are successfully enqueueing but not dequeuing and are stuck in ready state (STATE = 0).  The ENQ_TIME is 5 hours ahead of system time.  In one environment, AQ is working (10g 10.2.0.4.0).  In the other environment, it is not working (11g 11.2.0.3.0).
    I just did the following:
    1. Purged queue table
    2. Stopped queues
    3. Dropped queues
    4. Dropped queue table
    5. Created queue table
    6. Created queues
    7. Started queues
    I tested once and a record was inserted in the queue table:
    MSGID      <msgid>
    CORRID     
    PRIORITY      1
    STATE      0
    DELAY     
    EXPIRATION     
    TIME_MANAGER_INFO     
    LOCAL_ORDER_NO      0
    CHAIN_NO      0
    CSCN      0
    DSCN      0
    ENQ_TIME      12/23/2014 4:33:43.338902 PM
    ENQ_UID      <enq_uid>
    ENQ_TID      <enq_tid>
    DEQ_TIME     
    DEQ_UID     
    DEQ_TID     
    RETRY_COUNT      0
    EXCEPTION_QSCHEMA     
    EXCEPTION_QUEUE     
    STEP_NO      0
    RECIPIENT_KEY      0
    DEQUEUE_MSGID     
    SENDER_NAME     
    SENDER_ADDRESS     
    SENDER_PROTOCOL     
    USER_DATA      <user_data>
    USER_PROP     
    Notice the RETRY_COUNT is 0.  The ENQ_TIME is 5 hours ahead.  In the procedures to enqueue and dequeue, there are no errors.
    Following is the plsql to enqueue:
    CREATE OR REPLACE PACKAGE BODY
    pkg_2
    AS
        FUNCTION queue_create_thing ( <parameters> )
            RETURN NUMBER
        IS
            enqueue_options     dbms_aq.enqueue_options_t;
            message_properties  dbms_aq.message_properties_t;
            message_handle      RAW(16);
            v_message           msg_type;
            v_thing_id          things.id%TYPE;
        BEGIN
            v_message := msg_type( <parameters> );
            dbms_aq.enqueue(queue_name => '<queue name>',
                            enqueue_options => enqueue_options,
                            message_properties => message_properties,
                            payload => v_message,
                            msgid => message_handle);
            RETURN v_thing_id;
        EXCEPTION
            WHEN OTHERS
            THEN
               errpkg.record_and_stop (SQLCODE);
        END queue_create_thing;
        PROCEDURE queue_delete_thing( <parameters> )
        IS
            enqueue_options     dbms_aq.enqueue_options_t;
            message_properties  dbms_aq.message_properties_t;
            message_handle      RAW(16);
            v_message           msg_type;
        BEGIN
            v_message := msg_type( <parameters> );
            dbms_aq.enqueue(queue_name => '<queue name>',
                            enqueue_options => enqueue_options,
                            message_properties => message_properties,
                            payload => v_message,
                            msgid => message_handle);
        END;
    END pkg_2;
    Following is the code to dequeue:
    CREATE OR REPLACE PACKAGE BODY
    pkg_1
    AS 
        PROCEDURE create_thing ( context IN RAW,
                                    reginfo IN sys.aq$_reg_info,
                                    descr IN sys.aq$_descriptor,
                                    payload IN RAW,
                                    payloadl IN NUMBER )
        IS 
            dequeue_options dbms_aq.dequeue_options_t;
            message_properties dbms_aq.message_properties_t;
            message_handle RAW(16);
            message msg_type;
        BEGIN
            dequeue_options.msgid := descr.msg_id;
            dequeue_options.consumer_name := descr.consumer_name;
            DBMS_AQ.DEQUEUE(queue_name => descr.queue_name,
                            dequeue_options => dequeue_options,
                            message_properties => message_properties,
                            payload => message,
                            msgid => message_handle);
            pkg_2.create_thing( p_thing_id => message.thing_id );
            UPDATE table t
               SET creation_complete = 1
             WHERE id = message.thing_id;
            COMMIT;
        EXCEPTION
            WHEN OTHERS
            THEN
                ROLLBACK;
                plog.error(SQLERRM);
                plog.full_call_stack;
        END create_thing;
        PROCEDURE delete_thing ( context IN RAW,
                                    reginfo IN sys.aq$_reg_info,
                                    descr IN sys.aq$_descriptor,
                                    payload IN RAW,
                                    payloadl IN NUMBER )
        IS 
            dequeue_options dbms_aq.dequeue_options_t;
            message_properties dbms_aq.message_properties_t;
            message_handle RAW(16);
            message msg_type;
        BEGIN
            dequeue_options.msgid := descr.msg_id;
            dequeue_options.consumer_name := descr.consumer_name;
            DBMS_AQ.DEQUEUE(queue_name => descr.queue_name,
                            dequeue_options => dequeue_options,
                            message_properties => message_properties,
                            payload => message,
                            msgid => message_handle);
            pkg_2.delete_thing( p_thing_id => message.thing_id );
            COMMIT;
        EXCEPTION
            WHEN OTHERS
            THEN
                ROLLBACK;
                plog.error(SQLERRM);
                plog.full_call_stack;
        END delete_thing;   
    END pkg_1;

    Following is the code to create the queue:
    BEGIN
      SYS.DBMS_AQADM.STOP_QUEUE ( QUEUE_NAME => '<queue name>');
      SYS.DBMS_AQADM.DROP_QUEUE ( QUEUE_NAME => '<queue name>');
    END;
    BEGIN
      SYS.DBMS_AQADM.CREATE_QUEUE
        QUEUE_NAME          =>   '<queue name>'
       ,QUEUE_TABLE         =>   '<queue table>'
       ,QUEUE_TYPE          =>   SYS.DBMS_AQADM.NORMAL_QUEUE
       ,MAX_RETRIES         =>   5
       ,RETRY_DELAY         =>   0
       ,RETENTION_TIME      =>   0
       ,COMMENT             =>   'Queue for processing creation of things'
    END;
    BEGIN
      SYS.DBMS_AQADM.START_QUEUE
        QUEUE_NAME => '<queue name>'
       ,ENQUEUE => TRUE
       ,DEQUEUE => TRUE
    END;

  • Cannot restore my brand new iphone 4s ,got stuck in DFU mode and itunes shows error code (-1) please help?

    Cannot restore my brand new iphone 4s ,got stuck in DFU mode and itunes shows error code (-1) please help?
    repeatedly tried from diffierent computers and the same error code pops up (error -1)

    That's a hardware problem which will require a trip to the Apple store for evaluation, unless your phone has been jailbroken, then it's a corrupt hosts file (and we can't help you with that here as it is against the forum's terms of use).

  • VM got stuck in "stopping" state, and cannot be stopped

    Dear all,
    I am using Oracle VM 3.2.2.
    One of my VM got stuck in "stopping" state, and cannot be stopped.
    How can I troubleshoot this problem...

    Q: Is the VM still running, i.e. can you ssh to the VM?
    Q: Find the server where the VM is running, and restart the ovs-agent, i.e. "service ovs-agent restart". Did this help, or is the agent crashed, any zombies?
    Possible root cause: These type of errors are typically ovs-agent bugs. First update oracle vm manager to the 3.2.4 release, not 3.2.6. Next update the dom0s to 3.2.4, not 3.2.6. You may need to setup a ULN 3.2.4 yum repo to update the dom0s. As you can see in these forms, 3.2.6 is may not ready for prime time, stick with 3.2.4, is stable.

  • Wonder if anyone can help? Have just bought a new Macbook pro and installed FCP7. I thought that I would get quicktime pro but stuck with QTX. Downloaded QT7 but it won't let me install it. Any suggestions? B

    Wonder if anyone can help? Have just bought a new Macbook pro and installed FCP7. I thought that I would get quicktime pro as standard but stuck with QTX. Downloaded QT7 but it won't let me install it. Says I can't do install as I already have QTX. Does FCP not come with QTpro or am I jsut being stupid. Any suggestions would be great. Thanks.  B

    Hi there,
    Are you running Lion or Snow Leopard? either way this may help by the looks of it.
    http://www.macworld.com/article/161320/2011/07/lion_quicktime7.html
    cheers
    Andy

  • When I load cds i get a message that states, "User not registered for online use." This problem has only begun since the new itunes update and is only a problem on my pc laptop.  Media content (track names, etc.) do not load.  Thanks

    When I load cds i get a message that states, "User not registered for online use." This problem has only begun since the new itunes update and is only a problem on my pc laptop.  Media content (track names, etc.) do not load.  Thanks

    See  Re: itunes 12 track names not found and user not registered for online use.
    tt2

Maybe you are looking for

  • How to find accurate number of Rows, and size of all the tables of a Schema

    HI, How to find the accurate number of Rows, and size of all the tables of a Schema ???? Thanks.

  • Spool list receipient in SM36

    Hi, I run a report in background that has 220 pages list output.The same is sent to SBWP after I maintain spool list receipient parameters.But when I open the attachment in inbox I can see only 25 pages attachment displaying, of size 17K.Are there an

  • Error message when burning audio CD from iTunes

    I tried to burn an audio CD and got the following error message: "The attempt to burn a disc failed. The device failed to calibrate the laser power level for this media." Can anyone help?

  • CFGRID format=HTML not working in IE8

    I'm using Cold Fusion 10 and trying a cfgrid and it does not work in IE8.  It works perfectly in FF, of course. :-). It IS within a Cfform in my .cfm file.  Even when I take it down to it's simplest form to try to debug it doesn't work, but here is m

  • Cairgorm 3 sample applications - errors in unit tests

    After the last update the sample applications started to work - they now even show images. But the unit tests for Commands are reporting errors on my machine: TypeError: Error #1034: Type Coercion failed: cannot convert []@56443a9 to XMLList. at asmo