|
-
DOT-INVADER
i was just wondering, i have a dynamic text with 0000 inside.
in swf, nothing appears.
is there a way to see that numbers without putting "0000" or something else?
-
Senior Member
No there isn't without the parenthesis. Flash believes that it is helping you by shortening it.
-genesis f5
-
i don't quite understand what you are trying to do
but is this any use
Code:
makeup = function (tstring, maxLength) {
tstring = tstring.toString()
var trailing = maxLength - tstring.length;
for (var i = 0; i < trailing; i++) {
tstring = "0" + tstring;
}
trace (tstring);
};
// makeup(number you want to display, length of output)
makeup (1, 5);
-
Senior Member
Update
I was able to add the 4 "0"'s without the parenthesis. All I did was put the numbers the dynamic text box before loading it.
I stand corrected. However, if you were to use actionscripting to do the job, you would need to use parenthesis.
or use trickman's example, lol---^
-genesis f5
-
DOT-INVADER
2 minutes, 3 (!) replies ^^
thanks a lot.
-
Flash Developer on a break
He wants a number that always has like four digits.
Like: 0001, 0002, 0108, 2625, etc
And in that case, you can use Trickmans script.
Edit: Genesis, in that case, Flash sees your '0000' as a string. At least, I think.
-
DOT-INVADER
no, i don't want a number that always has four digits. four digits was just an example, the more important was the fact that the number zero doesn't show...
...if i put "0000" with parenthesis, what happens when i tell +=1?
-
Gross Pecululatarian
Look, text boxes can only hold text.
To put some text in the box, just do this:
myString = "345443";
To get it out to do somthing, do this:
myNumber = Number(myString);
myNumber += 5;
myNumber *= 5;
then myString = String(myNumber); (The String() function may not be needed here).
-
why do you want 0's to show anyways?
-
DOT-INVADER
well, when we begin a game, the score is supposed to be at 0...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|