A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: zero number with dynamic text

  1. #1
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    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?

  2. #2
    Senior Member Genesis F5's Avatar
    Join Date
    Jan 2002
    Location
    Unallocated memory
    Posts
    1,845
    No there isn't without the parenthesis. Flash believes that it is helping you by shortening it.

    -genesis f5

  3. #3
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    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);

  4. #4
    Senior Member Genesis F5's Avatar
    Join Date
    Jan 2002
    Location
    Unallocated memory
    Posts
    1,845
    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

  5. #5
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    2 minutes, 3 (!) replies ^^
    thanks a lot.

  6. #6
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    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.

  7. #7
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    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?

  8. #8
    Gross Pecululatarian Ed Mack's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    2,954
    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).

  9. #9
    Senior Member
    Join Date
    Mar 2002
    Posts
    308
    why do you want 0's to show anyways?

  10. #10
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center