views:

487

answers:

2

I am using Flash CS3 - AS 3.0

i have the following code that i am using to make the image count external, I am not sure if you all are familiar with Slideshow pro, i dont think that you need to in order to help me.

    function albumStuff(event:SSPDataEvent) {
if (event.type=="albumData") {
total1.text =  event.data.totalImages;
}
}

how would i make a leading zero come up infront of the number that comes up in that text field as long as its 9 and under??

I hope my question isn't confusing

A: 
 function leadingZero(num : Number) : String {
    if(num < 10) {
       return "0" + num;
    }
    return num.toString();
 }
maxmc
thanks, but how would I incorporate this into the code i currently have :/ i just started doing 3.0 , cause i had to do it for this client
total1.text = leadingZero(Number(event.data.totalImages));
maxmc
thanks words perfectly
works perfectly is what i meant** lol
A: 

You may use Casalib's NumberUtil.

The library's website.

For a new comer, the library provides a lot of useful little functions and it is a very good learning material when you look at its source.

Andy Li
ill check it out