Forse avevo dimenticato di dire che il tutto è in AS3 e l' errore che ricevo è il seguente:

1119: Access of possibly undefined property lenght through a reference with static type String.

sembrerebbe che la proprietà "lenght" non sia definita.