Decimal point for numbers in the script.

Hello!

So I build a flash program that will run a dashboard threatened just like the c# file to this Web site (Jeopardy! |) Coding4Fun Articles | Channel 9) because it is more beneficial for me to build it in flash than to pay $80 + for a Phidget. Everything went very well. However, I can't get the string to add commas for the life of me! I tried the NumberFormatter class, but nothing happens. I tried to import it, but it does not work nor receive code building advice. I would say that my AS3 knowledge ahead of a N00B, but not yet the intermediaries. I am only doing this for a hobby.

This code is below. I'm working on the first player and the $200: button, everything here is in what regards to the score of the first player and the +/-functions $200:

var firstPlayerScore:int;

firstPlayerScore = 0

var questionValue:Number = 0;

p1Score.text = "$" + String (firstPlayerScore);

p1200btn.addEventListener (MouseEvent.CLICK, firstNumber);

p1addbtn.addEventListener (MouseEvent.CLICK, addP1);

p1minusbtn.addEventListener (MouseEvent.CLICK, dropP1);

function firstNumber(Event:MouseEvent):void {}

questionValue = 200

}

function addP1(Event:MouseEvent):void {}

firstPlayerScore = firstPlayerScore + questionValue;

p1Score.text = "$" + String (firstPlayerScore);

questionValue = 0

}

function dropP1(Event:MouseEvent):void {}

firstPlayerScore = firstPlayerScore - questionValue;

p1Score.text = "$" + String (firstPlayerScore);

questionValue = 0

}

End of the code

Any help would be greatly appreciated. Thank you!

Given that the two functions of your repeat the same code you can probably create another function for them both to share and that extending further, passing the textfield andf score as arguments that you can share for all players...

function addP1(Event:MouseEvent):void {}

firstPlayerScore = firstPlayerScore + questionValue;

writeScore (p1Score, firstPlayerScore);

}

function dropP1(Event:MouseEvent):void {}

firstPlayerScore = firstPlayerScore - questionValue;

writeScore (p1Score, firstPlayerScore);

}

function writeScore(tField:TextField,_score:int):void {}

var commaScore:String =... add commas here, but you intend to do

tField.text = "$" + commaScore;

questionValue = 0

}

If you want to help the NumberFormatter, you will need to provide some information about it.

Tags: Adobe Animate

Similar Questions

  • RM-YD022 send any decimal point. What is the solution?

    RM-YD022 send any decimal point. What is the solution?

    Hello
    Welcome to the community of Sony.

    The button of the decimal point can be used with the number buttons 0-9 and press ENT to select digital channels. For example, to enter in 5.1, press [5] [.] [1] and ENT.
    The television receives digital channels?

  • Point to add to the script or Grep Style?

    Hello

    Is it possible to add a hightlight to a script?  Basically, what I want to do is highlight the text and the tricky part is that the text changes size depending on the size of the file, we are working on that.  I want to highlight automatically the "FOR PROFESSIONAL USE ONLY" the way that we do now is to underscore that in the menu options underscore: say my font size is 8, leading 9.6 (these will always change).

    Weight: = 9.6

    Shift: = - 8*.33

    Color = yellow

    It's the way we do now.  Can it be scripted or Grep style which will automatically do this for certain lines of text only?  And no matter the font size calculate what he needs to do if its 2pt, 10pt 100 PT etc... It will highlight the text specified correctly?

    I hope it's possible...

    Thank you

    The lower one is best.

    I remove a bug and also if not 'what' is provided to the point function culminating and there is no entry in find it which is the find panel of text and text is selected, then this text is highlighted.

    An idea in the script is that a shortcut can be applied to it and it will get its information from the Panel of text search.

    So for now to change the answer to this one

    // Highlight function by Trevor
    // http://creative-scripts.com
    // Custom Scripts for Adobe InDesign, Illustrator and a lot more
    // Beta Version 1
    // https://forums.adobe.com/message/8898663#8898663
    
    function highlight(what, color) {
        var range, s, doc;
        doc = app.properties.activeDocument;
        if (!doc) {
            return 'No Active Document';
        }
        s = app.selection && app.selection[0];
        range = (s && s.properties.underline !== undefined && s.characters.length) ? s : doc;
        app.doScript(f, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Highlight Text');
    
        function f() {
            var finds, find, l, leading, pointSize, currentChangeProps;
            color = color || app.activeDocument.colors.itemByName('Yellow');
            // Store current find change text settings
            currentFindTextWhat = app.findTextPreferences.findWhat;
            currentChangeProps = app.changeTextPreferences.properties;
            what = what || currentFindTextWhat;
            if (what !== '') {
                // if no what is provided then the current entry in the find text panel will be used
                app.findTextPreferences.findWhat = what;
                app.changeTextPreferences.changeTo = '';
                app.changeTextPreferences.underline = true;
                app.changeTextPreferences.underlineColor = color;
                finds = range.findText();
                range.changeText();
                l = finds.length;
                while (l--) {
                    find = finds[l];
                    leading = find.leading;
                    pointSize = find.pointSize;
                    leading = pointSize * find.autoLeading / 100;
                    find.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
                    find.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
                }
                app.findTextPreferences.findWhat = currentFindTextWhat;
                app.changeTextPreferences.properties = currentChangeProps;
            } else if (range !== app.activeDocument) {
                leading = range.leading;
                pointSize = range.pointSize;
                leading = pointSize * range.autoLeading / 100;
                range.underline = true;
                range.underlineColor = color;
                range.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
                range.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
            }
        }
    }
    
    /***************************************************************************************************************************************
    ** If text is selected then the "highlighting" is only applied within the selected text                                              **
    ** Otherwise the "highlighting" is applied within the whole document                                                                **
    ** One could change this to apply to what ever is selected in the Find text document if one wanted to                                **
    ** To highlight the word(s) in the find text panel just use highlight(); or highlight(undefined, app.activeDocument.swatches[5]);    **
    ** One can use highlight('Foo'); to highlight "foo" and ignore what's in the find text panel                                        **
    ** The formating / styles etc. for the find are taken from the find panel                                                            **
    ** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
    ** otherwise yellow will be used                                                                                                    **
    ** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
    ** If text is selected and what argument is given and the find what in the find panel is empty then the selected text is highlighted **
    **************************************************************************************************************************************/
    
    highlight();
    
  • Months of searching for numbers on the sheet

    Hello all and thanks in advance.

    I have tabs at the top. DATA (sheet 1), JAN (sheet 2), FEB (record 3), etc. until the end of the year.

    Data sheet will be the months on the left now I want care to go to the form to correct month and takes the total of the column relative to the other leaves and place in the correct cell line. (I've been copy paste, but I know there is an easier way to do this, so I turn to the people who know the numbers unlike my lack of knowledge.)

    On the leaves of the month, I would also like to highlight the line that are sat and Sun.

    Thanks again everyone for their help.

    Rich

    In the material master

    Hi, NN,.

    You will have a Table for each month. Each Table must have a different name. Your summary table lists more than 12 months, then I would say the table name from each month is named with the name of the month AND the year.

    The monthly tables may appear on separate sheets, or the same sheet. The key, as far as the formulae are concerned, is that each Table can be identified by its name.

    The following example includes only the table for April 2016, named "APR 2016", I assumed that the total line will be row 33 on each table of data collection, but wrote the formula to allow the placement of the line totals in other places. The lines for most of the actual days have been hidden and has not been designated, as these labels have no role in the operation of the formula.

    The TOTALS is defined as a footer line. The formula, in the columns showing a value is SUM (a) where 'a' is the letter of the column to be added. (The two values of zero have been entered manually for example).

    The table has a unique formula, entered in cell B3 and filled with right and until the last line for which there is a Table whose name corresponds to the label in column A. For example, the formula has been met only 3 online.

    B3: = INDEX (APRIL 2016: $A$ 1: $ 33, MATCH $N ("TOTALS", APRIL 2016: $A, 0), GAME ($ 1 B, APRIL 2016: $1: $1.0),)

    Syntax:

    INSTRUCTION (range,-l'index of the line, column-index, index of the surface)

    range: all of the cells in the source table

    the index of the line: the number of the start line to get the value. This is provided by the first statement of the GAME.

    the index of the column: the number of the column from which to get the value. This is provided by the second statement to MATCH.

    the index of the surface: omis. By default, 1. There is only 1 area of application of this INDEX, all of the source table.

    MATCH (image search-search for, - where - method)

    EQUIV function returns the position in the list of the search for value.

    First case:

    search for: TOTALS text

    search - where: column A of table source

    method): 0 means finding the exact value.

    Second case:

    search for: the text contained in the cell of line 1 of the specified column. That form is completed on the right, the increments of the column by one for each stage.

    search - where: line 1 of table source

    method): 0 means finding the exact value.

    The formula should be changed for each new line. Three references to "APR 2016" should be changed to match the name of the table to collect this row grand totals. Once edited in column A, the formula can be filled right and automatically adapts to his new position.

    Note: The duration value in column F of the table of the month wouldn't transfer and keep the same formula in column C of the summary table. Any attempt to restore the format to match your example resulted in a triangle of error.

    Kind regards

    Barry

  • Search does not work for numbers in the contents of a file

    Windows 7 search doesn't seem to work for partial digital channels.

    I put 123456789 inside a text file.

    Search works only if I find the exact numeric string that is content: 123456789

    If I try to get 34567 (content: 34567) it will not find the file.

    Any ideas?

    [edit: I found a way without using the command prompt.]  See the answer later.]

    Windows 7 Search can only search successfully if the string is entered in the text separately, except that the string can be the beginning of a string that appears in the text.  This behavior is true for the text in general, not just the numbers.  Other than downloading some other utility search (there are many of those who are free), you can use the command prompt, navigate to which you want to search for (if you have not done this before, you'll learn stuff here) and enter:

    Findstr /s /m 34567 * > c:\results.txt

    The/s is to allow the search subdirectories (subfolders).  The / m is to remove the display of all the lines of text containing a match and just show the file names (and subdirectory paths).  The * is to indicate that you want to search all files in the current directory.  You could put *.txt to restrict the search to the text files, for example.  The > c:\results.txt part is to take the results of research and rather than display them on the screen, save them in a text file named results.txt on drive C.

  • Add numbers inside the script

    I have a script to automate printing.

    I have a box on the top of each page that will be checked if the page should be printed.

    Then a loop puts each page number in a table that is then run through a printing process.

    The part shown here prompts the user the number of pages to print through the length of array property.

    for (pa var = 0; pa < = 3; pa ++) {}

    If (this.getField ('PRINT' '. + pa + '.)) CKB') .value! = 'Off') {}

    printarr [printarr. Length] = pa;

    }

    }

    App.Alert ("your file contains" + printarr.length + "pages.", 4, 0,"printing");

    Now, I need to add '2' to this number, because more than two pages will accompany this feature.

    For example, if the user filled with 8 pages, I need to tell him that 10 pages will be printed.

    App.Alert ("your file contains" + (printarr.length + 2) + "Pages.", 4, 0, 'printing');

  • How to set different fonts for numbers in the titles and tables of contents

    Hello

    I noticed some people to use a different font for the numbers in the titles and tables of contents to get an extra magic. Is it possible to automate the use of fonts in paragraph styles?

    Oh and suggestions on which fonts would be a good thing for numbers?

    Thank you!

    Furthermore, you must doany of this fancy stuff if you use an OpenType font that made OSF glyphs (and if you are not you will need to set the font as part of your style). Just head on to the style definition and enable OSF there OpenType features section.

  • Why won't a decimal (defined for numbers) text input area?

    I want the user to enter a decimal number in BER, for example, 1234.56.

    I put the BER to accept only numbers. It will accept 123456 but won't with a decimal number 1234.56 (does not accept a decimal number to any number of post).

    Does anyone know if this is a bug or a limitation of the numbered ETB?

    Yes, numbered TEB recognize decimals. You can use a normal TEB, without restriction to the numbers.

    Lilybiri

  • Comparison of decimal point in numbers

    Dear all,

    I am facing a problem to compare a decimal number bridge.

    How can I compare 4589.1256 is equal to 4589.125689 or 256.5689 is equal to 256.568 as.

    SOUNDEX does not work with the number. Rounded number is not allowed.

    I did not understand what to do?

    Grateful if someone help me on this issue.

    look towards the members of the forums.

    I don't know what the problem is in the use of the turn off.

    However if you decide a threshold that will tell you that the numbers are same then you can say

    IF (ABS (num1 - num2))< .001="" then="" --="" taking="" the="" differential="" threshold="" for="" all="" the="" numbers="" as="">
    "Equal".
    ON THE OTHER
    "Not equal".
    END IF;

  • looking for help on the script PowercLI.

    I'm looking for a script powershell group based vmsessions on the State of vmtools version so that I can plan the upgrade to version VMtools on virtual machines.

    Please use the below script and let me know if problems.

    Claire

    $logfile = "result.txt".

    $vms = «»

    $output = «»

    $temp =""

    $vm =""

    To connect to vcenter Server

    $vcenter = read-host "enter the vCenter Instance.

    to connect-viserver-Server $vcenter - WarningAction SilentlyContinue

    Get-Date | out-file $logfile

    echo "= details = | out-file $logfile - Append

    $vms = get-Content.\list.txt

    $output = get - vm $vms | SELECT name, vmhost, PowerState, version, toolsversion, toolsversionstatus, comments.

    | Tri-objet-property toolsversionstatus | FT - AutoSize GroupBy - toolsversionstatus-wrap

    $output

    $output | Out-file $logfile - append

    Disconnect-VIServer *-confirm: $false

  • The mouse launch point for slide in the wrong place, can not be moved?

    Hello world

    I'm back in Captivate after some time away and I thought that it was possible to move the starting point of a mouse, but can't seem to do it.

    I use 7 Captivate. The sequence of the slide is crossing the scroll bar, scroll down, then come back to the left to click on a link. For some reason any on this third slide, the path of the mouse starts up in the upper left corner. I guess it's possible, that there was a foreign slide between the roller and the slide of problem I deleted what is causing the problem, I do not remember.

    If I move the 3rd slide the rim, I can use the "align to previous slide' for her to start where it should, but I can't stay there, when I step back, and if I try this alignment after the slide of scroll, he puts it in the upper left corner even.

    I searched the Web and saw a mention of the abduction of a cache, so I did, but it did not help. I looked through the forum messages and doesn't seem all that has been useful in this regard.

    Any ideas or suggestions?

    Thank you!

    Since the second slide (scrolling) is animated (full movement), there is no layer of real mice, right?

    So the third slide is not a starting point.

    Try...

    'Mouse show' on this second slide and place it at the end of the timeline to a very short length, it seems very quickly where the full-motion-ends-up mouse.

    If this does not work, take a still shot of the last image of the slide of the query and make a new slide 3, 'See the mouse' and the mouse should stick to the position that you place (i.e. above the place where the mouse has ended on the previous slide in the query).

  • multiple choice with partial credit question, I have 10 responses only 6 are correct.  How to assign 10 points for each of the six correct answers for a total of 60 points setting?

    How can I assign partial credit so that for each possible answer 6 out of 10 each correct answer gets 10 points each, with a possible total score of 60 points quiz?

    To Captivate 7, please go to the Quizzing workspace. You will have the properties and properties Quiz Panel visible. I will now repeat the workflow, I explained briefly for CP7:

    • Check the partial score in the Quiz properties and also multiple responses.
    • Indicate the correct answers on the stage
    • Select the first correct answer on the stage text caption and indicate its score (10pts) in the properties panel, not in the Quiz properties!
    • Repeat the same for each correct answer
    • Check the total score in the properties of the Quiz Panel: should now be 60pts to the full question.

    None of the quiz system variables can be changed, they are read-only. System variables in Captivate 6 - Captivate blog explains the system variables for 6 categories, there are a few changes in 7: new features of Captivate 7.01 - Captivate blog but the Quiz category is always read-only.

  • set values for numbers in the precision and scale

    Hello.

    I have a column named total amount by which the total showed up as 999. I want to show resembles 999.99.

    Amount total is a database column.

    My query:

    Select

    p.PRODUCT_ID,

    PN.product_name,

    p.PRODUCT_QTY,

    p.unit_price,

    p.TOTAL_AMOUNT

    OMS_SHIP_CART_DETAIL p, pn OMS_PRODUCT

    where p.product_id = pn.product_id

    and user_id = 1

    Run it below and check the last column.

    Select

    p.PRODUCT_ID,

    PN.product_name,

    p.PRODUCT_QTY,

    p.unit_price,

    TO_CHAR (p.TOTAL_AMOUNT, '99999999999999.99') Total_amount

    OMS_SHIP_CART_DETAIL p, pn OMS_PRODUCT

    where p.product_id = pn.product_id

    and user_id = 1

    In running this you can print your 999.00 value, if the value of your database is 999.

    Is there a reason why you want to do like 999.99, which would be incorrect according to the value of the database

  • LV 8.6f1 - different decimal point to the development &amp; exe

    Hello

    In my program I want to use the decimal point '. ' and not the local symbol of the PC.

    So, I turned this option in the category "FAÇADE".

    In the development system, it works very well on the screen and in the recorded data (*.lvm & *.xls) files the "."  will be used.

    But when I create a my program exe file it will be always used a ',' as the decimal separator (on the same computer and screen in all the saved data files).

    Can someone help me?

    Jan

    LV 8.6f1

    The option is stored in the file LabVIEW.ini. This is what is used by the development environment. When you build an exe, the exe is using application_name.ini. So copy the configuration ini (useLocalDecimalPt = False) to application_name.ini, and who understand the distribution of your application.

  • Line numbers in the table in a calculated text field

    How calculated script works incrementally number a field calculated and return the number of lines in the field of the extreme left of a table?

    What I need, is that each row in the table is numbered consecutively in the area of the far left and that the new created lines are numbered correctly at the end of the user.

    Hello

    You have to move the script to the layout event: loan. This isn't the most effective event, because it triggers every time changes. For this reason however your needs well, because whenever a row is added or deleted, the index numbers will be updated.

    Here is an example letter (for a maximum of four lines). The same approach should apply to numbers. The script is located in the layout event: loan of the first cell.

    There is an example here: https://acrobat.com/#d=Zk2XWWDUWNfG * VuRTNy5QQ

    Good luck

    Niall

Maybe you are looking for