SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    India
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to rund a number

    My code

    var number = 100;
    var number2 = 100/3;
    trace(number2);
    Ourput 33.333333333333336

    I want it displyed as 33.33.

    How do do this ?

    I have one more question. I display this output in a text box. It display as normal text. Is there any way i can show ourput as formated text, for example bold, red color.

    Current code is

    resultText_text.text = number2;

  2. #2
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code Actionscript:
    resultText_text.text = Math.round(number2 * 100) / 100;

    That should round it to two decimal places for you, off the top of my head. If not, it's got to be close!

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    India
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, that is what i want.

    Now i display the text in a TextInput box. Can i change color of the TextInput ? If not want other component can be used instead of TextInput. I need time displayed like a digtal clock. Now it shows in normal text, i need option to change look and feel of the text displayed.

  4. #4
    SitePoint Evangelist ferrari_chris's Avatar
    Join Date
    Mar 2008
    Location
    NP, New Zealand
    Posts
    576
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should be able to manually set the font and style of the text input box when you place it on the stage. Remember to embed the font though if you're using an obscure one or it won't work when users enter data if they don't have the font.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •