What's the real deal? Is there a reason it's better (or worse) to favor
one practice over the other?
Im new to AS3 so still learning from what ive been told you declare a
static var here and any you want to update in the class body!
----- Original Message -----
From: Jim McIntyre
To: Flash Coders List
Sent: Thursday, July 17, 2008 7:11 PM
Subject: Re: [Flashcoders] AS3 - Problem with first item in Array
I got the impression from the AS2 documentation that one *should* set an
initial value for a variable in the class body, as long as the initial
value could be defined at compile time.
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001116.html
However, I've seen many folks leave the value undefined by not assigning
anything in the class body, like your example below.
What's the real deal? Is there a reason it's better (or worse) to favor
one practice over the other?
-Jim
jonathan howe wrote:
> Hi, SJM,
>
> Hypothesis: Don't know if this is different for AS3 (couldn't find the
> appropriate documentation in a quick search) but I got into the habit of
> avoiding assigning values for declared variables in the class body unless
> they are static variables. My recommendation would be declare variables like
> your arrays in the class body:
>
> public var containerX:Number;
>
> And then initialize them in your mainClass() function
>
> containerX = (stage.stageWidth / 5);
>
> Otherwise you may get unpredictable results based on what's in memory at the
> time.
>
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders