Hello,

I have a static initializer in my class and it works ok:

private static var BLACK:TextFormat = new TextFormat('Arial', 24,
0x000000, true);
private static var RED:TextFormat   = new TextFormat('Arial', 24,
0xFF0000, true);
// place "1" closer to "0" in the "10" string
{
        BLACK.letterSpacing = -4;
        RED.letterSpacing = -4;
}

But when I try to add a for-loop there (I need to
add some data to static array I have in the class),
then I get errors "Access of undefined property i":

{
        BLACK.letterSpacing = -4;
        RED.letterSpacing = -4;
                        
        for (var i:uint = 0; i < 10; i++)
                trace(i);
}

I have to move the variable i outside the initializer:

private static var i:uint;
{
        BLACK.letterSpacing = -4;
        RED.letterSpacing = -4;
                        
        for (i = 0; i < 10; i++)
                trace(i);
}

Isn't it strange? It looks ugly to me...

Regards
Alex
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to