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 abou

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Scott Hyndman
ut the html mail) Scott -Original Message- From: [EMAIL PROTECTED] on behalf of A.Cicak Sent: Fri 28/10/2005 6:32 PM To: flashcoders@chattyfig.figleaf.com Cc: Subject: [Flashcoders] Re: Newbie AS3 question Well, I dont agree,

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 cl

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 m

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 o

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Frédéric v . Bochmann
; everywhere would ruin the fun of writing AS2 and AS3. And yes there are cases in AS2 where your class method might need "this" in front of all methods and members it uses; this is mostly the case if you're redirecting methods to other classes with their prototype, thus returning to

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Martin Wood
ryanm wrote: 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 con

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 some

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. Actua

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Frédéric v . Bochmann
useful to know exactly what you are accessing. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of zwetan Sent: October 29, 2005 9:03 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Re: Newbie AS3 question > >>No need to get

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Frédéric v . Bochmann
those contexts. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: October 28, 2005 7:53 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Re: Newbie AS3 question You do know that it (this.) is being added for you at compile time in AS2

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Robert Tweed
(-: Tatactic :-) wrote: In the book of C.Moock, he recommends the redundant use of [this] No he doesn't. He says "some people prefer" but he also clearly states that it is not used anywhere in the book, because it makes code overly verbose and hence, less readable. If you want to check, it's

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread (-: Tatactic :-)
nc, 2004, ISBN 0-596-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

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Robert Tweed
zwetan wrote: Who cares? All that means is that there is no semantic difference between the two. There is a difference for AS3 ! (and this is the correct behaviour) http://livedocs.macromedia.com/labs/1/flex/langref/statements.html#this "To call a function defined in a dynamic class, you must

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread JesterXL
TECTED]> To: Sent: Saturday, October 29, 2005 6:59 AM Subject: [Flashcoders] Re: Newbie AS3 question Problem with JasterXL's class is initialization. For example if you had to initialize something in that class you should make static method called InitCurrencyFormatter(). But when to call it?

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 (thi

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Robert Tweed
Muzak wrote: [fixed top posting] 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 th

[Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread A.Cicak
Problem with JasterXL's class is initialization. For example if you had to initialize something in that class you should make static method called InitCurrencyFormatter(). But when to call it? If other classes are using CurrencyFormatter than you should ensure to call InitCurrencyFormatter() be

[Flashcoders] Re: Newbie AS3 question

2005-10-29 Thread Costello, Rob R
yes, this is true in ActionScript referencing or instantiating a singleton class via a static getInstance method, is a different matter to all methods of a class being static > > > The former is calling an instance method and the latter is calling a > > > static > > > method. > > > > > > Inst

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-28 Thread Muzak
You do know that it (this.) is being added for you at compile time in AS2, right? Muzak - Original Message - From: "Frédéric v. Bochmann" <[EMAIL PROTECTED]> To: "'Flashcoders mailing list'" Sent: Saturday, October 29, 2005 12:53 AM Subject: RE: [

Re: [Flashcoders] Re: Newbie AS3 question

2005-10-28 Thread Spike
In a perfect world all methods would be short and succinct. Unfortunately we don't live in a perfect world and it's sometimes more confusing to split things up than to just leave longer methods. I've seen plenty of code where 200 lines was the realistic minimum without creating methods that had 15

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 re-fa

RE: [Flashcoders] Re: Newbie AS3 question

2005-10-28 Thread Frédéric v . Bochmann
ge- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of A.Cicak Sent: October 28, 2005 6:33 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Re: Newbie AS3 question Well, I dont agree, "this" keyword refers to current class, so its only more typing to include

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? Probab

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 t

[Flashcoders] Re: Newbie AS3 question

2005-10-28 Thread A.Cicak
Well, I dont agree, "this" keyword refers to current class, so its only more typing to include it, and making code less readable. Only reason keyword "this" exists is if you want to pass reference to current object somewhere, in which case you must use "this". To me using "this" in your code make