how to use decimals

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • taruna
    New Member
    • Jun 2007
    • 1

    how to use decimals

    hi...
    i am working with dynamic text box. made a scroller and on the upward n downward button want to give a hover effect (its like when i go over them it should itself scroll up or down respectively) . i am able to do that but the only problem i am facing is i cant be able to control its speed. the least value i can use is "1"....can i use decimal ? or what other value will be least than "1" ....

    thank you....
  • Atran
    Contributor
    • May 2007
    • 319

    #2
    Originally posted by taruna
    hi...
    i am working with dynamic text box. made a scroller and on the upward n downward button want to give a hover effect (its like when i go over them it should itself scroll up or down respectively) . i am able to do that but the only problem i am facing is i cant be able to control its speed. the least value i can use is "1"....can i use decimal ? or what other value will be least than "1" ....

    thank you....
    Hello:
    you can try this code:
    Code:
    var num:Number = 23.5674;
    var mynum:String = (Math.round(num*100)/100).toString();
    trace(mynum); 
    var mynum:String = (Math.round(num*1000)/1000).toString();
    trace(mynum); 
    var mynum:String = (Math.round(num*10000)/100000).toString();
    trace(mynum);
    Hope this help you.

    Comment

    • xNephilimx
      Recognized Expert New Member
      • Jun 2007
      • 213

      #3
      Originally posted by Atran
      Hello:
      you can try this code:
      Code:
      var num:Number = 23.5674;
      var mynum:String = (Math.round(num*100)/100).toString();
      trace(mynum); 
      var mynum:String = (Math.round(num*1000)/1000).toString();
      trace(mynum); 
      var mynum:String = (Math.round(num*10000)/100000).toString();
      trace(mynum);
      Hope this help you.
      Mmm.. I think he's talkin about scrolling a dynamic textbox directly with the scroll property, if that's the case, there's no way to increment/decrement scroll with a float number.

      Taruna, You should use a movieclip that holds the text and dynamically get the dymensions of that movieclip (cause the text is loaded externally, you said) and then calculate the proportion of movement between the scrollbar and the movieclip, and so on... the code it's rather long. I think in kirupa.com there are great tutorials to achieve this. I have my own version,that I think it's a little more useful but never made a tutorial out of it. Anyway, the "Simple Custom Scrollbar" it's a great tutorial on this subject, check it out.

      Comment

      • Atran
        Contributor
        • May 2007
        • 319

        #4
        Originally posted by xNephilimx
        Mmm.. I think he's talkin about scrolling a dynamic textbox directly with the scroll property, if that's the case, there's no way to increment/decrement scroll with a float number.

        Taruna, You should use a movieclip that holds the text and dynamically get the dymensions of that movieclip (cause the text is loaded externally, you said) and then calculate the proportion of movement between the scrollbar and the movieclip, and so on... the code it's rather long. I think in kirupa.com there are great tutorials to achieve this. I have my own version,that I think it's a little more useful but never made a tutorial out of it. Anyway, the "Simple Custom Scrollbar" it's a great tutorial on this subject, check it out.
        Ok xNephilimx, I will check that.

        Comment

        Working...