Because counter is a class property and your function is static. Try this:
public static var counter:int = 0; > From: Isaac Alves <isaacal...@gmail.com> > Reply-To: Flash Coders List <flashcoders@chattyfig.figleaf.com> > Date: Thu, 3 Sep 2009 16:23:36 -0300 > To: <flashcoders@chattyfig.figleaf.com> > Subject: [Flashcoders] 1120: Access of undefined property > > could someone please tell me why in the following script , the flash > runtime doesn´t recognize the var counter? > 1120: Access of undefined property counter. > > package > { > public class StringUtils > { > public var counter:int = 0; > > public static function generateRandomString(newLength:uint = 1, > userAlphabet:String = > "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"):String > { > trace (counter); > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders This e-mail is intended only for the named person or entity to which it is addressed and contains valuable business information that is proprietary, privileged, confidential and/or otherwise protected from disclosure. If you received this e-mail in error, any review, use, dissemination, distribution or copying of this e-mail is strictly prohibited. Please notify us immediately of the error via e-mail to disclai...@tbwachiat.com and please delete the e-mail from your system, retaining no copies in any media. We appreciate your cooperation. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders