Showing results with one decimal two. Force the decimal.

Hello

Im a simple computing of writing device.

You enter a digit, press one of the two buttons to multiply by a number, and then the result is displayed. The result is copied hide the result from the button you press on and visa versa.

I'm having a problem to display the result with a decimal point two constant.

I'm using strings and so do not know how to do this.

Here is my code:

import flash.events.MouseEvent;

restrict entry to only numbers textfield

txtInput.Restrict = "0-9";

restrict the input textfield only a two-digit

txtinput.maxChars = 6;

event listeners

btnW.addEventListener (MouseEvent.CLICK, WHandler);

btnC.addEventListener (MouseEvent.CLICK, CHandler);

btnW.addEventListener (MouseEvent.CLICK, hideC);

btnC.addEventListener (MouseEvent.CLICK, hideW);

functions

function WHandler (e:MouseEvent): void

{

calculation of white

var answerW:Number = Number (txtinput.text) * Number (0.90);

txtWResult.text = answerW.toString ();

}

function of CHandler (e:MouseEvent): void

{

calculation of the color

var answerC:Number = Number (txtinput.text) * Number (0.99).

txtCResult.text = answerC.toString ();

}

function hideC (e:MouseEvent): void

{

Hide the result color

txtCResult.visible = false;

txtWResult.visible = true;

}

function hideW (e:MouseEvent): void

{

Hide the white result

txtWResult.visible = false;

txtCResult.visible = true;

}

After having had a look online I found these two resources:

http://helpx.Adobe.com/Flash/KB/rounding-specific-decimal-places-Flash.html

and

http://StackOverflow.com/questions/11469321/decimals-to-one-decimal-place-in-AS3

But I'm confused when combining these techniques with ropes.

Any help would be greatly appreciated,

Thanks in advance

Mr B

Use the toFixed() class number instead of the toString() method.  The result is a string that contains the number of decimal places you specify.

var answerW:Number = Number (txtinput.text) * Number (0.90);

txtWResult.text = answerW.toFixed (2);

var answerC:Number = Number (txtinput.text) * Number (0.99).

txtCResult.text = answerC.toFixed (2);

Tags: Adobe Animate

Similar Questions

  • I look integrated in the block of the legend of slide show, a widget like "Accordion" for, with one click, or by the way with the mouse, open a new caption for each photo. I tried with 'Accordion' Muse, it does not work. I haven't tried to copy and paste,

    Issue.

    I look integrated in the block of the legend of slide show, a widget like "Accordion" for, with one click, or by the way with the mouse, open a new caption for each photo. I tried with 'Accordion' Muse, it does not work. I haven't tried to copy and paste, but no result. The widget disappear into the legend of block. disappear. Do you have a solution?

    Thank you

    Loïc

    Accordion Panel tabs should, with click and open the container.

    Please provide the url of the site where it does not, also if you can provide an example where we can see the exact action, then it would help us.

    Thank you

    Sanjit

  • I am a new user. The trial version ch & LR have been donloaded 2 fair days and he was attuned to the monthly plan. However, when open the LR, there all the same show PS with one day left and trial version with 29 days. Please please advise and would l

    I am a new user. The trial version ch & LR were uploaded 2 days ago and just joined the monthly plan. However, when open the LR, there all the same show PS with one day left and trial version with 29 days. Please please Advisor and would like to know if other apps like bridge etc. are included in the plan. Thank you very much.

    Troubleshooting FAQ: What should I do if I have a subscription, but my application acts as if I had a trial?

  • hiding and showing captions with one button of evil

    I try to display a legend (MSO) with the click of a button and then hide them again with the same key. I created an ESM with two States that with the text, the other without and then created an icon with a more [normal] sign that triggers the second State with the text. Once the button is pressed, it becomes a sign less [click here], that the next step is where I am running into trouble. I just want the user to click the button "-" to hide the legend before moving on to the page next or article. I tried all the button state combinations but cannot hide legend short of creating a new button somewhere else on the page, this is not desired. I've seen this feature in publications such as National Geographic and Vogue, so I know it's possible. It seems so simple but I can't understand it. Be able to close the legend after showing it will add another level of interaction and professionalism to my post... Please help someone.

    Hi, how to do it is to have an invisible button on top an object multistate it passes to the next State (or the State no matter what you call it). You will notice in the National Geographic that you don't have to click exactly on the button for the text.

    So state one would signal more, State 2 would your text your sign and the legend. The invisible button would include button region or a larger area.  make sense?

  • Color laserjet 4600 - problem with one color (yellow) for the most part does not print

    Colors look purpleish when printing photos.  It turns out that this is a problem with yellow print.

    We tried to replace the yellow toner cartridge, and it was not fixed.

    PQ troubleshooting, the yellow page is empty except for a thin (16th of an inch) to 99% a horizontal line at the top of the page.

    In the configuration page, all the different areas that should have the yellow are mostly empty, with the exception of the same sort of thin horizontal line at the top of each of these areas.  After updating the firmware from 03.001.0 to 03.016.0: in addition to what is described on the configuration page, some of the fields in the configuration page that should be yellow, have a pale magenta and more this yellow line.

    Our technician came several times and has so far tried to replace the hvps, scanner laser, toner alignment and trainer kit Board.  Nothing has improved the question.  Then for the replacement is the regulator dc ($1000).

    Anyone here have an opinion on what could cause this problem?  It seems they are just throwing parts at home and we're about to tell them to give up.

    It wasn't the dc controller.  I figured out well out - somehow, there was a spring missing behind one of the speeds in the train of drum roll.

  • Created a slide show time with a different speed than the speed for which it has been created in Windows MEdia Center

    HELP PLEASE! 1

    I create a slide show with music in Windows Media Center.

    I have change in SETTINGS, the display time of 3 seconds.

    I have burn the slide show with music on a DVD.

    The copy on DVD playing 7 second display speed.

    I want to play as I created it, to fit the music.

    HOW?

    Thank you

    Rhod

    Sydney Australia

    Use the creator of Windows DVD or Windows Movie Maker (new versions available here) to refine your settings.

  • Microsoft account to share with one other Member of the family. How can I stop them to access my mail?

    When I open my mail it is accessible without using my password. How can I stop this because then any body can accessit.

    When I open my mail it is accessible without using my password. How can I stop this because then any body can accessit.

    You need to create and use two Windows logon accounts: one for you, a member of your family, each with its own password. This will keep well separated things.
  • OM: order with one org, ship of the other org, that matters of dente?

    We want to create a sales order from an org (leave the org said) and the other org (B) ship, and we want both revenue and COGS account to be fresh for these parameters for org A, is - it possible? How to configure?

    I just tested in our development system that income will be charged to the org A and CMV is charged to org B.

    How to charge org has for revenue and COGS account?

    Since you mailed Org b and R11i system call CMV at time of shipment, it will always show the Org B. I guess you need to customize the workflow the COGS. the values of accounts ethe driv.

  • Since one or two weeks, the docking station settings are not saved. When I restart the computer, the dock is not finished because he was and is located at the bottom and not left

    The parameters of the dock in the system prefs not saved. When I restart the computer, the dock is always located at the same place (bottom) even if I changed before. I have mac os X 11 5 on a mac pro (mid-2010).

    In the case where all third party apps, anti virus are installed, remove them. Click go > hold down the option key and don't release > click library > Preferences find com.apple.dock.plist, com.apple.systempreferences.plist and right click on them and move to the trash.

    The apple logo reboot and empty the trash.

  • Problems with error Windows Audio and Control Panel "one or more of the audio service is not running.

    I'm a bit of a technophobe, but I'll try to explain my problem, I got better.  I recently had a problem with Windows 8 and refreshed my system.  After refreshing, I installed AVG Anti-virus and that's where my problems really started.  After installing AVG I have no sound and my control panel usually pop up.  The box is displayed but there is nothing in it and it sorts just of sticks, frozen.  I tried the fixes recommended to fix my sound. The speaker in my taskbar icon has a red x on it and when I try to open it it goes right to the problem-solving mode, then comes up with "one or more of the audio service is not running.  When I try "run services.msc' and try to start Windows Audio through Services I get error 0x800706cc.  I tried to uninstall AVG and reboot, but it did make a difference.  Please help, this leads me to the madness now.  Nothing I try seems to work!

    Installation of AVG is when the problems started, I would start by undoing that.  Since the normal uninstall did not help, use system restore to return to a work situation.  Check here and use the #1 option.

  • Digital formatting with Variable decimal places

    Acrobat 9 Pro, Windows XP

    I have created a form that has a number of text box form fields that must be numeric only by the applicant of the form. However, for any field data of this type, the number of digits that can be entered can vary from 0 to 3 and the applicant wants all decimal unnecessary to appear in the final output (for example, an entry "1.2" does not appear as "1,200"). The standard number formatting properties always show all decimals, so I know that it is not this way. No calculations will be made with one of these entries - the applicant form is simply enter data and then printing to make it readable for the end user.

    I know that the following line of JavaScript in the hit limit the digital input only Custom property, but how do I change the syntax to allow a decimal writing:

    Event.RC = (! event.change | / ^ \d$/.test(event.change))

    I probably also need a script to format for decimals, but I don't know where to look in the JavaScript for Acrobat QAnywhere or the JavaScript reference DND.

    Thanks in advance for any help.

    OK, here's a link to an example: https://workspaces.acrobat.com/?d=Xf5mboqmkpf-zRxB9MVAJw

    The code that is called in Format typing of the text events field and is in a JavaScript at the level of the document named "format". Post again if you have any questions.

  • Slideshow module and text overlay on only one or two images.

    I read the manual, using the slide show, and I see that I can add text to images, but I want to add some text in the first image only and maybe one or two inside the view. Is this possible?

    One way:

    1. in the overlays Panel, place a check next to text overlays

    2. click on the ABC in the toolbar and select the legend or title in the menu down

    3 clear the field caption or title in the metadata (library Module) for all images of the slide show. (if necessary)

    4 enter the legend or title you are only looking for the text images.

    5. set the color, size and placement in service.

  • How can I add a map page in photo books that will show destinations with arrows like iPhotos used to do?

    In iPhotos, you can create a page of book that showed cards with your travel destinations. The kids loved because they can now see to what extent they traveled. This feature doesn't seem to be transported on the photos App updated. Can anyone explain why?

    You can add a map with markers places, but arrows like in iPhoto or Aperture are perhaps not available, because the pages with arrows caused constant crashes in iPhoto, who knows.

    As a workaround: you could create a map with location markers page and print the page in PDF format, and then draw the arrows in preview on the map and import the page map of pictures as a photo.  Add this photo to the photo book full page.

  • I have two Adobe Id with first ID, I used the trial version. When it expired, I did the second ID and purchased Adobe Acrobat proDC version with monthly subscription. On my first ID it shows now that I have Acrobat pro DC subscription. Second ID (the one

    I have two Adobe Id with first ID, I used the trial version. When it expired, I did the second ID and purchased Adobe Acrobat proDC version with monthly subscription. On my first ID it shows now that I have Acrobat pro DC subscription. Second ID (the one I bought the subscription) shows nothing. Now, during installation by using the ID of the first, all is going well, except using the software. He always says "your trial has expired! Using the ID of the second to make same duration does not work... I can't download the right version. Free trial only. Pleasehelp me. I'm desperate.

    Hi kimmok51975897,

    I will recommend you to contact our customer service team to get this fixed number. Follow this link Contact Customer Care, sign in using your Adobe ID (under which you subscription) & check on "still need help? Contact us' button.

    Kind regards
    Nicos

  • 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.

Maybe you are looking for