Calculator with two numbers

Dear Forum

Im working a calculator with a textfield. It can calculate if an input one number, but does not work when I try to enter two or three. I test several codes but they don't work at all. Could someone give me a helping hand. Please join you file.

var numeroEntrado = "";

var campoUno:int = 125;
var campoDos:int = 20;
var elResultado1 = 0;
var elResultado2 = 0;

d. Text = '125 grs.';
cholesterol. Text = '20 mml.';
colesterol.backgroundColor = 0x9999FF;
textoColesterol.backgroundColor = 0x9999FF;

numeroPorciones.maxChars = 3;
numeroPorciones.restrict = "0-9";

btn.addEventListener (MouseEvent.MOUSE_UP, suma);


function sienteTecla(event:KeyboardEvent):void {}

If (event.keyCode == 48) {numeroEntrado = 0 ;}
If (event.keyCode == 49) {numeroEntrado = 1 ;}
If (event.keyCode == 50) {numeroEntrado = 2 ;}
If (event.keyCode == 51) {numeroEntrado = 3 ;}
}


function suma(evt:MouseEvent):void {}
d. Text = "";
elResultado1 = (campoUno) Number * Number (numeroEntrado).
d. Text = elResultado1 + "grs".

cholesterol. Text = "";
elResultado2 = Number (campoDos) * Number (numeroEntrado).
cholesterol. Text = elResultado2 + "mml";

numeroPorciones.text = «»
}

Thank you

IN

It is hard to tell without understanding your intent.

I don't see where event listener for sienteTecla is assigned.

If numeroEntrado is supposed to be numeroPorciones value (a guess) so maybe you could just do something like this:

function suma(evt:MouseEvent):void {}

If ("numeroPorciones.text! =" ") {}
d. Text = "";
elResultado1 = (campoUno) Number * Number (numeroPorciones.text).
d. Text = elResultado1 + "grs".

cholesterol. Text = "";
elResultado2 = Number (campoDos) * Number (numeroPorciones.text).
cholesterol. Text = elResultado2 + "mml";
   
numeroPorciones.text = «»

}
}

Tags: Adobe Animate

Similar Questions

  • Mathematical calculation with the numbering of the current page

    Hello

    I am currently in a situation where I need 2 types of page numbers for a single page.

    delete.jpg

    To the right side, I use the current page number marker.

    Is there a way to make a mathematical calculation with number of current page on the left side?

    Something like 460 + current page number

    I can't use the data merge feature because all the page are already installed on.

    Kind regards.

    Hello

    You can run a script:

    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat = "~N";
    
    var
         FindGrep=app.activeDocument.findGrep(),
         len = FindGrep.length,
         item, pageNo, calcNo, rightSide,
         mDiff = 460;          // edit this value according to needs
    
         while (len-->0) {
              item = FindGrep[len];
              pageNo = item.parentTextFrames[0].parentPage.name;
              calcNo = parseInt(pageNo) + mDiff;
              item.paragraphs[0].contents = calcNo + "\t" + pageNo;
              rightSide = item.parentTextFrames[0].textFramePreferences.textColumnFixedWidth;
              with (item.paragraphs[0]) {
                   tabStops.add({alignment: TabStopAlignment.RIGHT_ALIGN, position: rightSide});
                   justification = Justification.LEFT_ALIGN;
                   }
              }
    

    that should work assuming management texts related with the pageNumbers are substituted (accessible)

    Jarek

  • How to tour calculations with two decimal places (scaling of the form)

    Hello

    I created an order form where customers enter the amount of product that they want to order and the form shows the total amount payable (including transport and sales tax). According to the user input, the amount total resulting sometimes contains more than two decimal places. How do I turn calculations to two decimal places? Is it possible to do this form on the scale?

    I'm new to using Acrobat for calculations. Any help would be greatly appreciated! Thank you...

    This should be:

    Event.Value = util.printf ("%.2f", event.value);

  • BlackBerry Smartphones 2 BBs with two numbers and even e-mail address

    Hello

    I have a BB with a number of Vodafone in Portugal. I want to buy now
    Another BB to use with another number to Vodafone, this case of
    Ireland.

    My question is if I can have two phones with the same
    at the same time Gmail address? When an e-mail is received, it will go
    two phones at the same time?

    Thanks for your help

    Manual

    Jameskemp is correct.

    When you configure an e-mail address on your BlackBerry, you are associating the delivery of this email address to your phone PIN code.  You can have an e-mail address goes to two different pins at the same time.

    Now, you know.

  • Question - calculation for two numbers of entries by the user

    I have a form where the user is required to enter two values (A and B) in order to perform a calculation.  It is, the calculation is A / B, so when they enter value, a time-out message immediately pop error on the form (because he's trying to divide by zero).

    What is the script so that the error message does not appear, then the user can enter A and B values without overflow error that appear immediately to A value entry?

    Hello

    You can wrap your script in an if expression.

    if (valueA ne 0 and valueB ne 0) then
         valueA / valueB
    endif
    
  • variable with two digits after the point

    Hi all

    How can I specify variable to work with two numbers (one, three) after the point?

    e.q.

    Set one to 3.14159265358 like (lack of knowledge here)

    return a

    3.14 returned must

    It is a two-step process:

    Set A to 3.14159265358

    Set A (round (A * 100)) / 100

    The 100 can be changed as needed.

    (144176)

  • When I subtract two numbers DBL and try to compare the result with another DBL, it fails

    I found a curious problem with subtraction and compare numbers DBL in LabVIEW (8.6). Here's how it works:

    1. subtract two numbers DBL such that the result is not incorporated. (Say, 3.2 - 3.1)

    2. compare the result with a constant/control that is on the result of the subtraction (in the example, 0.1)

    3 see the output of the comparison.

    If the result of the subtraction is an integer, the Boolean result is (as expected). If the result is not complete, the comparison fails.

    (Now, if I simply compare two floating point numbers, it works, so the issue is not with the node comparison itself, but with the data that is entered to the node). Can someone understand why this happens? It's unexpected, it's a pretty serious bug.

    It is provided with all programming languages. Numbers do not have an exact binary floating-point representation. This has been discussed endlessly. Never use the equal function with floats. You can use the function in the range and force.

  • After you rename a folder full of files using LR CC, I now have two of each DNG file with consecutive numbers providing unique names!

    After you rename a folder full of .dng and. MOV files using LR CC, I now have two of each file DNG image with consecutive numbers providing unique names. . MOV files are not affected. Activated with "Bridge" and found it said one is one Mac Application, either in the form of windows. I have Lightroom on Mac and Windows PC with local catalogues which are clouds synchronized (but never on at the same time). Could be the cause of this problem? It is possible that differ from the Mac and Windows version catalogs and their creative together via the Cloud technology synchronization can cause this duplication is obvious when all files are renamed by using a number of automatic sequence?

    Yes, my default sort criteria is by file name as my beginning of file names with a reverse date followed by a sequence number. I think at some stage I must have reproduced all the files on the Windows PC and saved with a different range of sequence numbers after the element of date filenames outside of LR. Sometime later I have imported in the Lightroom. When I decided to rename all of them using this naming convention, I discovered the duplication hiding behind different file names. This turns out to be a lesson on the practices of workflow systems.

  • This calculator works only with round numbers

    I need help,

    This calculator works only with the numbers series, but is this 1.9 * 6 the result is 11.399999999999999 instead of 11.4

    Ware is the problem, can it be resolved?

    Theanks in advace.

    <? XML version = "1.0" encoding = "utf-8"? >

    < mx:Application ' xmlns:mx = ' http://www.Adobe.com/2006/MXML "layout =" " vertical " >

    < mx:Script >

    <! [CDATA]

    private function getTotal():Sub

    {

    var myInt:int = parseInt (input.text);

    var myFloat:Number = parseFloat (input.text);

    var myNumber:Number = new Number (Input.Text);

    var myInt2:int = parseInt (input2.text);

    var myFloat2:Number = parseFloat (input2.text);

    var myNumber2:Number = new Number (INPUT2. (Text);

    total. Data = (myNumber) * (myNumber2);

    }

    []] >

    < / mx:Script >

    < mx:TextInput id=" entry " />

    < mx:TextInput id=" INPUT2 " />

    < mx:TextInput id=" total " />

    < mx:Button " label = ' Button "click ="getTotal ();" />

    < / mx:Application >

    Welcome to the joys of IEEE 754 floating-point arithmetic. For more fun, try ".1 + 1 - 1»

    The simplest answer is probably to limit your result with Number.toFixed (). The answer is not so easy is to write your own class BigDecimal (in Java).

    --
    Maciek Sakrejda
    Truviso, Inc..
    www.truviso.com
    Truviso recruiting: http://www.truviso.com/company-careers.php?i=87

  • Mathematical calculations with variables

    I am using Captivate 4.  I need to create a series of slides that allow the user to enter a number.  Based on the number entered, one of the two slides will show (this action advanced I've written successfully) giving them a response.  I need help is the next step.  The mathematical calculations.  The necessary action will take numbers entered by the user, by the number of 40 and a second number to multiply by 8 and then add the two numbers.

    I've named my variable fields where the user will enter the number, but do not know how to write the script for my response.  Any help is greatly appreciated.

    I can provide additional details, you need, just ask

    Thank you!

    Hello

    You must create the user variables to have available in the drop-down list, use the Variables tab in the dialog box with the advanced actions and create v_result. For the most part, I prefer setting the variables, also those of use with first of the ETB. Don't forget to associate the appropriate variables (v_one and v_two) with the ETB under the Advanced tab in the properties of TEB.

    On the other issue, I'll try to create it, but am a little pressed for time. And I almost forgot how to use the interface in CP4, it's so much better to CP5. I made the blog a lot about variables and advanced actions. Take a look at the comments of two introductions to the variables (examples are for CP5, but can be achieved in CP4 too):

    Curious about variables (part 1)

    Unleash the power of variables (part 2)

    Lilybiri

    Sorry, think you're asking on how to trigger the action: you will need to attach to an event. This event can enter a slide or a button, click box.

  • Calculation of two fields

    I want to simply divide one field by another using formcalc or java and have the results in a % in another area. I want to divide PaymentTotal by MonthlyTotal fields and have the result in a % in the field of the DTI.

    Hello

    Whenever you are dividing by an object value that is better check, is not null or 0.

    if (MonthlyTotal.rawValue != null || MonthlyTotal.rawValue != 0)
    {
         this.rawValue = PaymentTotal.rawValue / MonthlyTotal.rawValue;
    }
    else
    {
         this.rawValue = null;
    }
    
      
    Also, I put a model in the object/field tab.
    There was an error in the MonthlyTotal; missing closing)
    In regards to your other post, I see that you have imported the form of another (obvious from the names of the root = topmostSubform) application. It has imported the page in the form of a graph, the white collar of the page is blocking the grid. This explains why you do not see the grid. However, I would always put in operation and make as fine as you need.
    Hope that helps,
    Niall
    PS As you used mainly textfields. You want numbers, I would recommend changing to numericFields. You can do this by selecting them in groups, then go on the drop-down list on the object type in the object/field tab. This prevents users from entering text and fouling of the calculations. Finally, you can then define templates for these fields (currency with two decimal places).
  • Channel calculation with if loop

    Hello!

    I had a syntax problem concerning the calculation of channel (I must confess that I'm not an expert at all...).

    Here's the problem: I got a measurement with two groups and multiple channels. I need to create a new channel that goes to 1 when the right conditions are given and will scratch if they are not met. My problem is that I do not know how to run a calculation and how to address the channels within an if loop.

    Somehow, it should look like this:

    Call BadExample

    Function BadExample (NewCreatedChannel)

    If

    ("Ch('[2]/Example') > = 1000") and ("Ch('[2]/Example2') < 1600)="" and ("ch('[2]/example3')=""> 10") and ("Ch('[2]/Example4')< 0.025*("ch('[2]/example5')+="" 10)="" and ("ch('[2]/example6')=""> 210")

    or

    ("Ch('[2]/Example') > = 1200") and ("Ch('[2]/Example2') < 1800)="" and ("ch('[2]/example3')=""> 10") and ("Ch('[2]/Example4')< 0.025*("ch('[2]/example5')+="" 10)="" and ("ch('[2]/example6')=""> 240")

    then

    NewCreatedChannel = 1

    On the other

    NewCreatedChannel = 0

    End if

    End Function

    I know that this won't work... but I hope you get the idea!

    It would help even if someone could tell me how to implement a channel calculated in this loop.

    Thank you!!!

    Hey Melihson,

    There are many possibilities to do so.

    An example is to use the calculator IIF function that works with both channels.

    Simply declare the condition and choose the values true and false, which can be 0 and 1.

    Here's a simple example using the Example.TDM file:

    Call Data.Root.Clear)
    Call DataFileLoad "(par EXEMPLE.)" CT","CT","load")

    Call Calculate ("Ch(""Results/Res1"") = IIF (Ch(""[2]/Schall_1"") > 0.1, 1, 0) '")
    Call Calculate ("Ch(""Results/Res2"") = IIF (Ch(""[2]/Schall_2"") > 0.4, 1, 0) '")
    Call Calculate ("Ch(""Results/ResAnd"") = AndB (Ch(""Results/Res1""), Ch(""Results/Res2""))")

    If you use the English version just change channel names.

    This code snipped evaluates two channels and combines logically with ETB function.

    You can also use this approach for more than two channels.

    Best regards

    Christian

  • Using a C DLL with complex numbers of Labview

    Hello

    So I would try to use the existing C99 to perform calculations, and for the functions code, the code accepts and returns type numbers 'double complex.   I have spent half a day to find out the hard way that Visual Studio does not complex.h header, so before you spend more time trying to compile a DLL, not done Labview even allows you to send and receive complex of a DLL call numbers?

    When I open the node to call a library function and go to settings, the closest return type I see is double 8 bytes, but nothing about the complex... so...   I am not even convinced that this will work... did anyone done this before?

    Thank you

    Yes, you can use complex numbers. See the example with properly called LabVIEW "" call DLL". There is an example here that deals with complex numbers. You may need to write a wrapper DLL, if.

  • Problem setting up Port Forwarding with two routers.

    I can't set up by Linksys RT31P2 and routers port forwarding WRT160Nv3.

    My setup is Webstar Modem = RT31P2 = WRT160N = Mac OS 10.6.5. (No configurable modem and ISP do not prevent port forwarding. It comes with two Linksys routers).

    I had a Monty Python-going around with the support of Cisco cat; and follow up with telephone assistance in which the agent knew nothing about port forwarding and his supervisor expressed the view that it was not possible with two routers. Sigh.

    If anyone can help me with step by step specific and simple instructions to configure routers. I know that the basic procedures. I'm not clear, what exactly changes on routers.

    I read that portforward.com has to say and it does not work so I must be misunderstanding something.

    The ip address of my computer is 192.168.1.103.  Are the last three digits of this speech concluded the two routers in the area on the port forwarding page? What other changes should be done what router?

    I know the port numbers that I use are OK because I can implement successfully if I connect to one or other of the routers (but not both), and my software of p2p shows port are open.

    Any help and suggestions most welcome.

    If you set up as I have suggested that you have only a single LAN that will be using in your addresses * 192.168.15 case. So in your case:

    1. change the address LAN IP of 192.168.1.1 to 192.168.15.2 WRT.
    2 disable the DHCP server.
    3. connect the LAN of the WRT port to port LAN of the RT.

    That's all. Disable the DHCP server will not affect whatever it is that you're connected LAN - LAN and DHCP server on the RT is still operational.

    After the change, previously the WRT computers may require a reboot to get a new address 192.168.15. *.

    Your computer to which you are transferring must have an IP static and not dynamic (or variable). Check the current IP information on this computer. It must have an IP address like 192.168.15.103, mask 255.255.255.0, gateway 192.168.15.1 subnet and DNS 192.168.15.1 server or maybe two other IP addresses instead. Note DNS servers if you do not 192.168.15.1.

    Then configure a static IP address on the computer. Use something like 192.168.15.10, 255.255.255.0 gateway 192.168.15.1 and the DNS servers you found before.

    After this implement 192.168.15.10 port forwarding.

  • Number shaped with two digits "behind the point" :-)

    Hello

    Please excuse my very bad English because I'm french :-)

    I use the beta JDE v4.7 and the Blackberry Storm Simulator included.

    I would like to know how to format a calculated result as #. # (a floating-point value with two digits "behind the point') to display in a RichTextField instance.

    I tried this:

    """"
    String strSomme;
    String strSommeTTC;
    Double dblSomme;
    Double dblSommeTTC;
                   
    strSomme = saisieField.getText ();
                   
    dblSomme = Double.parseDouble (strSomme);
    dblSommeTTC = dblSomme * 119,6 / 100.0;
     
    Trainer fmt = new Formatter();
     
    strSommeTTC = fmt.formatNumber(dblSommeTTC,2);
     
    RichTextField affichageField = new RichTextField ("sum TTC:" + strSommeTTC, Field.NON_FOCUSABLE);
    Add (affichageField);
    """"
     
    Only the small portion of code compiles fine but I get an exception when you run the program in the Simulator: javax.microedition.global.UnsupportedLocaleException

    I don't know if the Formatter class is the best way to convert a 45.528652541 to 45.53 number for example.

    Thanks for any help.

    Nice day.

    Marc

    I ended up writing a method to do this...

        final static String toString(double sum)
        {
            // Turn random double into a clean currency format (ie 2 decimal places)
            StringBuffer result;
    
            if (Math.abs(sum) < .01)
            {
                result = new StringBuffer("0.00");
            }
            else
            {
                if (sum > 0)
                    sum = sum + 0.005;
                else
                    sum = sum - 0.005;
                result = new StringBuffer(Double.toString(sum));
                final int point = result.toString().indexOf('.');
                if (point > 0)  // If has a decimal point, may need to clip off after 2 decimal places
                {
                    if (point < (result.length()-2))  // eg "3.1415"
                    {
                        result =  new StringBuffer(result.toString().substring(0,point+3));
                    }
                }
            }
            return result.toString();
        }
    

    I would like to know if there is a better way!

Maybe you are looking for

  • Backlight problem Tecra A2 - image is very small

    HelloI have a Tecra A2 with a backlight problem.The LCD displays properly, but without any backlight, the image is very low. When the laptop is started is turned perfectly for about 3 seconds before turning off. Boots of portable code and can be used

  • HP Compaq Presario CQ56-102er

    Hello!Tell me the features detailed RAM this laptop.On the computer notebook page no detailed information.Thank you!

  • acquisition of USB-6009 2 inputs

    Hello I currently use a usb-6009 with labview 7.1 and DAQmx 8.1 to read the data in a file LVM to a sampling rate of 40 kHz.  Everything works perfectly when I read only one channel.  Problem is that I have to read 3 channels and when I put the DAQ a

  • I can't open outlook after installing IE9

    Microsoft has a problem program registry? I can't open outlook.  I looked at a few sites and comments I receive, there may be a registry problem.  I tried to install Internet explorer 9 yesterday announced that when my problems started.  Help

  • Toshiba laptop crashed two days ago and kept restarting itself

    I have this laptop for 2 years.  toshiba lap top was brand new when I bought it.When my lap top has crashed, I tried to fix it but kept rebooting the computer.  Thought I had to reformatt HDD.  Thought that the Toshiba recovery disks loaded windows.