On the SDK team we prefer to write
 
    var incorrects:Array = [];
 
because it generates smaller (and probably faster) bytecode, and we
think that
 
    var incorrects:Array = [ "a", "b", "c" ];
 
looks so much better than
 
    var incorrects:Array = new Array();
    incorrects[0] = "a";
    incorrects[1] = "b";
    incorrects[2] = "c";
 
Gordon Smith
Adobe Flex SDK Team

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tim Hoff
Sent: Thursday, January 17, 2008 11:04 PM
To: [email protected]
Subject: [flexcoders] Re: using an array



Hi,

It looks like you have declared the array, but haven't constructed it;
like so:

var incorrects:Array = new Array();

Some prefer:

var incorrects:Array = new Array;

-TH

Tim Hoff
Cynergy Systems  |  Technical Lead
3603 5th Ave. Suite A, San Diego, CA 92103
http://www.cynergysystems.com <http://www.cynergysystems.com> 

--- In [email protected], "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 
wrote:
>
> I thought I knew how to do this but it seems like everything little 
> thing I do makes e! rrors.
> 
> var incorrects:Array;
> incorrects[2]='asdf';
> TypeError: Error #1009: Cannot access a property or method of a null 
> object reference.
> 
> What is the matter ?
>


 

Reply via email to