Re: [Flashcoders] clean scripting

2008-03-12 Thread Muzak
In AS2 it does (and has been discussed here in the past), in AS3 it doesn't. - Original Message - From: Jesse Graupmann [EMAIL PROTECTED] To: 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Wednesday, March 12, 2008 5:38 AM Subject: RE: [Flashcoders] clean scripting

RE: [Flashcoders] clean scripting

2008-03-12 Thread Jesse Graupmann
To: Flash Coders List Subject: Re: [Flashcoders] clean scripting In AS2 it does (and has been discussed here in the past), in AS3 it doesn't. - Original Message - From: Jesse Graupmann [EMAIL PROTECTED] To: 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Wednesday, March 12

Re: [Flashcoders] clean scripting

2008-03-12 Thread Dave Mennenoh
So yea...WTF? I can't believe after my years of AS2 coding that it would have taken me this long to notice. I think I muttered those exact words. Bizzare behavior. Though I don't think I have ever run into it. Someone taught me long ago not to initialize class variables in their definitions.

Re: [Flashcoders] clean scripting

2008-03-12 Thread Andy Herrman
Here's my understanding of the reason behind this: AS2 is basically just syntactic sugar over AS1, and gets compiled down to the same thing. When defining a class you're actually defining things on the prototype, so doing this: -- class MyClass { public var myArray:Array; public

Re: [Flashcoders] clean scripting

2008-03-12 Thread Muzak
, March 12, 2008 9:02 PM Subject: Re: [Flashcoders] clean scripting Here's my understanding of the reason behind this: AS2 is basically just syntactic sugar over AS1, and gets compiled down to the same thing. When defining a class you're actually defining things on the prototype, so doing

RE: [Flashcoders] clean scripting

2008-03-11 Thread Matthew James Poole
Actually, I've seen that the values are often set quicker when initilaised in the contructor rather than against class members , but I think it looks tidier the way you've done it... imo -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Allandt Bik-Elliott

Re: [Flashcoders] clean scripting

2008-03-11 Thread Jer Brand
Not sure if this is correct for AS3, but I was under the impression that there was an actual performance penalty to doing things the first way (object creation and assignment in the class definition rather than in the methods or the constructor). Still, I like doing things the 2nd way, if only

Re: [Flashcoders] clean scripting

2008-03-11 Thread Mark Lapasa
Either way to me is a non-issue. However, it is an issue if I want to implement lazy instantiation. That is, instantiating objects only right before you need them. Thus, in your first example, the bulk of instantiation occurs up-front. Lazy instantiation

Re: [Flashcoders] clean scripting

2008-03-11 Thread Allandt Bik-Elliott (Receptacle)
they're both eager, though, aren't they? the only difference is that everything is instantiated in the first method of the class rather than in the class head a On 11 Mar 2008, at 18:10, Mark Lapasa wrote: Either way to me is a non-issue. However, it is an issue if I want to implement

RE: [Flashcoders] clean scripting

2008-03-11 Thread Cor
I go for the second option. Instanciate at the point you need it, and clear if no longer needed. It also keep memory use limited. HTH C -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Allandt Bik-Elliott (Receptacle) Verzonden: dinsdag 11 maart 2008 18:41

Re: [Flashcoders] clean scripting

2008-03-11 Thread Cory Petosky
To clarify, this difference only matters in the case of static class members. Anything non-static gets initialized at constructor-time regardless -- the difference is syntax only. On 3/11/08, Cor [EMAIL PROTECTED] wrote: I go for the second option. Instanciate at the point you need it, and

Re: [Flashcoders] clean scripting

2008-03-11 Thread Muzak
Allthough the following no longer seems to apply in AS3, it might be good to know. In AS2, if you have the following class: class MyClass { private var myArray:Array = new Array(); public function addItem(item:Object) { myArray.push(item); } public function get data():Array { return

Re: [Flashcoders] clean scripting

2008-03-11 Thread Allandt Bik-Elliott (Receptacle)
thanks for your input everyone i've gone for the second option because i can template it out better and it looks way neater (plus i can still keep all of my declarations in one place, the setVars() method) thanks again here's a copy of my template if you'd like it //code: package

Re: [Flashcoders] clean scripting

2008-03-11 Thread Steven Sacks
I'm going to chime in here. Lazy Instantiation is an irrelevant argument when you're instantiating in the constructor. What you perceive as cleaner is merely philosophical. var container:Sprite = new Sprite(); vs var container:Sprite; public function ClassName() { container = new

RE: [Flashcoders] clean scripting

2008-03-11 Thread Jesse Graupmann
); } public function get data():Array { return MyClass.myArray; } } regards, Jesse -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: Tuesday, March 11, 2008 4:51 PM To: Flash Coders List Subject: Re: [Flashcoders] clean scripting

Re: [Flashcoders] clean scripting

2008-03-11 Thread Fumio Nonaka
Of Muzak Sent: Tuesday, March 11, 2008 4:51 PM To: Flash Coders List Subject: Re: [Flashcoders] clean scripting Allthough the following no longer seems to apply in AS3, it might be good to know. In AS2, if you have the following class: class MyClass { private var myArray:Array = new Array

RE: [Flashcoders] clean scripting

2008-03-11 Thread Jesse Graupmann
PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks Sent: Tuesday, March 11, 2008 6:49 PM To: Flash Coders List Subject: Re: [Flashcoders] clean scripting I'm going to chime in here. Lazy Instantiation is an irrelevant argument when you're instantiating in the constructor. What you

Re: [Flashcoders] clean scripting

2008-03-11 Thread Paul Andrews
- Original Message - From: Allandt Bik-Elliott (Receptacle) [EMAIL PROTECTED] To: flashcoders flashcoders@chattyfig.figleaf.com Sent: Tuesday, March 11, 2008 5:41 PM Subject: [Flashcoders] clean scripting hi just a semantic question really when writing your classes, would you only