Re: [Flashcoders] 1120: Access of undefined property

2009-09-03 Thread Ian Thomas
Because your function is static.

Either make your var static too:

public static var counter:int=0;

or make your function non-static.

I'm sure you can Google static/non-static class members, but in short,
anything that's non-static is only available from within a class
instance (i.e. someone needs to have called new StringUtils()).

HTH,
   Ian

On Thu, Sep 3, 2009 at 8:23 PM, Isaac Alvesisaacal...@gmail.com wrote:
 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


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] 1120: Access of undefined property

2009-09-03 Thread Patrick Matte
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


RE: [Flashcoders] 1120: Access of undefined property

2009-09-03 Thread Cor
Because you function is static

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Isaac Alves
Sent: donderdag 3 september 2009 21:24
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


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] 1120: Access of undefined property

2009-09-03 Thread Gregory Boland
static function, they have a limited scope, can't see class variables unless
their static

On Thu, Sep 3, 2009 at 3:23 PM, Isaac Alves isaacal...@gmail.com wrote:

 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

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders