Re: [Flashcoders] Re: Newbie AS3 question

2005-11-01 Thread Spike
Yes indeed! You can usually find an alternative approach to solving the problem than using the singleton pattern, but it is distinctly different to using static methods. Glad to hear it works the way it does in other languages at least. Spike On 10/29/05, A.Cicak [EMAIL PROTECTED] wrote:

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-30 Thread Cedric Muller
I learned programming in Flash and I use this everyday, almost everyline ;) because scope has always been one of the thoughest thing in Flash :-) * cedric thanks ryanm In my opinion (and in the opinion of many much more competent developers than myself), it is always good to be explicit

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread zwetan
No need to get hyper about this. The matter stays that this used to be essential in AS1, thus probably why people still like to implicate him in their code. But I agree that putting this in an AS2 Class should be used only when necessary. You do know that it (this.) is being added for

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread (-: Tatactic :-)
-00652-7 Greetings N -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of zwetan Sent: samedi 29 octobre 2005 15:03 To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Re: Newbie AS3 question No need to get hyper about this. The matter stays

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread ryanm
The idea is to use it (this) when you have two variables with the same name, usually to distinguish between the class member and a locally declared variable. You must know that :) The compiler won't know to use this or not in those cases, so it is important to use it in those contexts.

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread ryanm
You do know that it (this.) is being added for you at compile time in AS2, right? Who cares? All that means is that there is no semantic difference between the two. Not quite. What it means is that the this is assumed, which is not always what you want. And if you need the reference

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Frédéric v . Bochmann
to the world of AS1. Cheers, Fredz./ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ryanm Sent: October 29, 2005 3:39 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Re: Newbie AS3 question The idea is to use it (this) when you have two

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread ryanm
All that to say, if your going to be putting this in front of every class member in AS2 and in AS3 you'll be missing the neat advantage of simplicity. As it were, the classes I write are rarely self-referential. Properties such as position, visibility, etc, are usually handled elsewhere or

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread ryanm
Of course there exists edge cases where that isnt feasible, but most programs dont implement DES algorithms (to relate this to an earlier post) and a lot of legacy code i have worked with has benefitted from being re-factored. I actually do have classes with methods so large that I had to

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Robert Tweed
ryanm wrote: You do know that it (this.) is being added for you at compile time in AS2, right? Who cares? All that means is that there is no semantic difference between the two. Not quite. What it means is that the this is assumed, which is not always what you want. You can force

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Scott Hyndman
this can also be used to refer an instance's member variable explicitly. Since scoping rules allow for a local variable (in a method) to be named the same as an instance member variable, this is required to differentiate between the two. (Sorry about the html mail) Scott

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-28 Thread Spike
Passing a reference to the current object is not the only place where using the this prefix is useful. If you come along maintain someone's code 6 months from now and you find a complex method of 200 lines of so, it's useful to have the this prefix to distinguish between variables that are local

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-28 Thread Spike
Forgot to mention, the other common place you'll see it is in constructors or anywhere else you find yourself with method arguments that match the name of an instance variable. public function Person(fname:String,lname:String) { this.fame = fname; this.lname = lname; } Is it good practice?

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-28 Thread Martin Wood
If you come along maintain someone's code 6 months from now and you find a complex method of 200 lines of so, it's useful to have the this prefix to distinguish between variables that are local to the function and those that are available to the instance. true, but i would also immediately