473,467 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to use decimals

1 New Member
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....
Jun 16 '07 #1
3 2309
Atran
319 Contributor
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:
Expand|Select|Wrap|Line Numbers
  1. var num:Number = 23.5674;
  2. var mynum:String = (Math.round(num*100)/100).toString();
  3. trace(mynum); 
  4. var mynum:String = (Math.round(num*1000)/1000).toString();
  5. trace(mynum); 
  6. var mynum:String = (Math.round(num*10000)/100000).toString();
  7. trace(mynum); 
  8.  
Hope this help you.
Jun 17 '07 #2
xNephilimx
213 Recognized Expert New Member
Hello:
you can try this code:
Expand|Select|Wrap|Line Numbers
  1. var num:Number = 23.5674;
  2. var mynum:String = (Math.round(num*100)/100).toString();
  3. trace(mynum); 
  4. var mynum:String = (Math.round(num*1000)/1000).toString();
  5. trace(mynum); 
  6. var mynum:String = (Math.round(num*10000)/100000).toString();
  7. trace(mynum); 
  8.  
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.
Jun 21 '07 #3
Atran
319 Contributor
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.
Jun 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Oswald | last post by:
Hey, how can I set the number of decimals? Example: 5 decimals 2.12345 2 decimals 2.12 I've found something about NumberFormat in the API, but without an example I can't solve this...
0
by: thx | last post by:
I have MySQL 4.0.18 on Windows 2000 and I have a problem with floats and decimals. The table has floats and decimals fields but when I enter non-integers in these fields, they get rounded. So if I...
2
by: westjon64 | last post by:
i am fairly new to c++, i need to know how to make it so you can input decimals into a file using the cin >> a command instead of just being able to input whole numbers and also how to make it so...
6
by: Donal McWeeney | last post by:
Hi, Is there a way to specify on the predefined format strings like P and N that you want displayed all the decimals in the number... for example 3 will display 3 2.1 will display 2.1...
13
by: vsts2007 | last post by:
hi, how can I change the number of decimals appeared in access reports... I put a formula in query and its giving three to four decimals in the output of report. I want to change the number of...
12
by: CNiall | last post by:
I am very new to Python (I started learning it just yesterday), but I have encountered a problem. I want to make a simple script that calculates the n-th root of a given number (e.g. 4th root of...
0
by: Edwin.Madari | last post by:
for nth square root: use math.sqrt n times for example ... num = math.sqrt(num) ... 5.0 all comparisons work fine for arbitrary floating point numbers... For readability print them with...
0
by: Tommy Nordgren | last post by:
On 3 aug 2008, at 17.16, Edwin.Madari@VerizonWireless.com wrote: Ehum. The OP wants to compute the nth root ( not the nth square root) ------ What is a woman that you forsake her, and the...
38
by: ssecorp | last post by:
char* reverse(char* str) { int length = strlen(str); char* acc; int i; for (i=0; i<=length-1; i++){ acc = str; } return acc; }
8
by: =?Utf-8?B?a2FyaW0=?= | last post by:
Hello All, why is this code is not showing the result in this format: 0.00 and showing it as only 0 Private Sub btn1_Click Debug.Print(Format$(Rnd() * 100, "0.00")) Dim d As Double =...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.