Thanks Gordon,
Absolutely agree that [] looks better if you are populating the array
during construction. Same would go with primitives.
>From a slightly different perspective, I would only say that using a
consistant style for constucting objects can also improve
readability. That being said, using = ("", [], 0, etc.) is probably
faster. If anyone knows this, you and the SDK team do. :-)
-TH
--- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> 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], "info1@" <info1@> 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 ?
> >
>