Currently I have to use two different text fields to display 10000 due to the different font sizes.
The 10 is a larger font and the 000 is a smaller font. When I assign '0 'to the dynamic text fields of the smaller font I get just that a '0' not a '000' which is what I want.
Question:
Is there an easy way to display leading zeros in a dynamic text field? Or can a dynamic text field have different character positions displayed in different font sizes? or both?
I have an input text field that is named in the properties box as 'numberOfKids'. When the program is executed, and a delete or backspace is pressed the input textfield goes blank and any calculations that use 'numberOfKids' shows NaN.I have trapped the NaN and undefined so that a numeric 0 shows up instead of a blank.
First problem: The cursor is to the left of the zero, so the first number inputted by the user is 10x larger than what they want. 0 becomes 10. How do I get the cursor to move to the right of the 0?
Second Problem: When I manually move the cursor to the right of the 0 and input a number, say 4, it shows up as 04. How do I delete the leading numeric zero in the input textfield?
Here's the code I am using:
calculateChildWeight = function () { if (isNaN(numberOfKids)) { numberOfKids = 0; } if ((numberOfKids) == undefined) { numberOfKids = 0; } if (numberOfKids>=0 && numberOfKids<=137) { numberOfKids = numberOfKids; } else { numberOfKids = 0; } if (isNaN(adjustedChildWeight)) { adjustedChildWeight = 0; } if ((adjustedChildWeight)=undefined) { adjustedChildWeight = 0; } adjustedChildWeight = Number(numberOfKids*(-100)); //numberOfKids.setSelection(numberOfKids.length, numberOfKids.length); //if (numberOfKids.length=2 && numberOfKids<10) { // remove the first character or leading zero// numberOfKids = numberOfKids;// }};
how I can format numbers in Flash so that it will show two decimal places regardless of the number itself?For example, if I have 4.5, then I would want this to be displayed as 4.50.
I'm showing the users score in a textbox. But if the number exceeds 1000 it should show 1.000 example: 10000000 => 10,000,000 I've been searching a lot on Google, but I just can't make it work. Can anyone help me with this? I've started something out with this code:
[URL]
Also, if I had the correct function, how would I made it split too if the number was 10.000, 100.000, etc..
Do I am able from some numbers like 132145 to make them look like that "13:21:45 Today" or "13:21:45 Tomorrow" !? I see that in AS2 this is able to do but don't know how to do it in AS3
I have some input text fields (by the text tool, not the component) in my form that I was wondering if they could be auto-formatted. I was looking specifically for dates & numbers. For example when the user inputs 082606 and then tabs away it would immediately update to 08/26/06, or when the user inputs 50000 it would immediately update to 50,000.
Is it possible to remove zeros from the end of a value? For example, i have an output value of 2200 kb but i want it to convert to 2.2 mb. Can this be done using actionscript 2.0?
Also, how could i check the value of the number and display the correct symbol?
I'm trying to find a way to manipulate an array; well, two, actually, but I suspect one solution will fix both.
I have an comma-seperated string of numbers pulled from an xml file, that correspond to the correct answers in a multiple-choice exam app I'm working on. The numbers will always appear low to high, but there could be any number of them up to a maximum of 10, for example:
1,3,5 2,3,5,7,8 1,2,8,9,10
I've seperated the list out into an array, but what I'm eventually going to need to do is to compare this array with another array containing the user's answers. The array of their answers won't necessarily have the same number of values as the array of correct answers.
So, I'm thinking one way round this would be to add zeros in between the numbers in each array, so that they will both have the same number of values. To re-write the example arrays above, these would be manipulated to:
1,0,3,0,5,0,0 (for 7 possible answers) 0,2,3,0,5,0,7,8,0 (for 9 possible answers) 1,2,0,0,0,0,0,8,9,10 (for 10 possible answers)
I can then follow the same process for the array of user's answers (which could be almost anything, but will be limited to the maximum number of responses, i.e. 7 for the first array in the above list), and then run a function to compare the two arrays, which will, after adding the zeros, have the same number of values.
I've made several attempts at this, but keep getting tangled up in loops and if statements... I'm not exactly an Actionscript ninja, as you may have guessed by now!
how I can approach the above, or know of an existing script that will do what I'm after?
How to fix date to retrieve minutes/hours with zeros ? E.g. it's 05:09 AM > trace(_date.getHours()+":"+_date.getMinutes()); //5:9 But I want 05:09 instead of 5:9 - so how to add zeros? var _date = new Date(); _min = _date.getMinutes(); //fix date: var _str:String = _min.toFixed(1); _min = Number(_str); trace(_date.getHours()+":"+_date.getMinutes()); = 5:9 ....
I'm modifying someone's old AS 2 Flash application and I need to pass numeric data in as a string OR have a properly formatted USD currency string in the end.
Currently, I might pass something like Data1=$34,000.00&Data2=$12,344.18&etc...
in via FlashVars. Assuming I show Data1 in a dynamic input field, I'd get something like "$34,0"
I'm not too concerned whether this is a super clean, proper solution or a functional hack-like solution with this application. It's needed, but only for a short time.
how to publish live video feed from webcam in h.264 format non VP6 format with FMS 3.5.2 without using Flash Media Live Encoder, and how to set all parametersto have a good quality and smooth video without interruption, i have a server with 50Mbit bandwidth output enough for a publisher and 10 clients meunderstand this thing's been months since I try but the quality ugly
I've looked in the user manual and I can't find any reference to toString() for syntax information. Isn't there a parameter for me to use to specify the string lenght? And whether to add leading zeros or not?Here's the code I need to add leading zeros:
playbutt.addEventListener(MouseEvent.CLICK, playSound); function playSound(e:Event){ SoundMixer.stopAll(); var num:Number = Math.ceil(Math.random()*43); bigNum.text = num.toString(); var path:String = "Track No" +
I'm a noob to actionscript so this should be easy:How do I delete leading characters from a string? I have a string that contains (at times) both numeric & non-numeric characters. If I want to delete all the leading 9's, how would I do that?var testVar:String = '999998gjek74k'; want the testVar to be 'gjek74k'.So far, I have (though not working):
var testVar:String = '999998gjek74k'; testVar.replace(/^0/g, "");
I want to generate a variable number of random numbers less than 16 with no duplicate numbers
Ive posted the fla, and what i'm doing is generating a random number and putting it into an array then using a for loop to cycle through the array for each new random number to check if its already there. if it is, then i want to regenerate that number.
if you test the fla you'll see that all i get in my array is some lovely zero's and i sort of know why this is, but don't know how to stop it.
I am trying to convert a string having numbers to an integer.
//15 9's are there var str:String="999999999999999" var res:Number = new Number(str);
But it is not able to convert correctly as the the var res now has the value 100000000000000000. I know that the number has 52 bits of memory, then why is it not able to do the conversion?
I want to make a textinput where a person can type in a price. I used "restrict" to only allow numbers and decimal. But the person can type in several decimals and create numbers like 11.1.1.1 or 11...11 or 1.11111
i want to restrict the entry to only one use of a decimal and only two numbers after the decimal.
any other way to format a textinput to a currency format?