The this keyword is genius. What's wrong with it, don't look techy
enough for ya? :P I can't imagine scripting without it.
- Andreas
Muzak wrote:
Well, to me it's the other way around.
Code that doesn't use proper references looks messy to me.
Whe I'm lazy or in a hurry, I do skip them, but I usually find myself adding
them afterwards anyway.
So, I'm with ryanm on this one ;-)
regards,
Muzak
----- Original Message -----
From: "Martin Wood" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, October 28, 2005 11:03 PM
Subject: Re: [Flashcoders] Newbie AS3 question
ryanm wrote:
What I don't get is why it needs "this.addChild" instead of just addChild. I've been sick of the keyword "this" for a long time
and have since avoided it in AS2.
Any reason that it needs to be back in for AS3?
Maybe because it's one of the most useful scope references ever invented?
The fundamental concept that you seem to miss is that "addChild" is meaningless by itself, it is a method of an object (in
proper OOP development), and if you just say "addChild", who is adding the child?
the context is the current class. Occasionally 'this' is useful if you happen to name a method parameter or local variable the
same as a member variable and need to distinguish the two.
But, I dont agree that its bad form to leave it out, nor is it any more
difficult to maintain.
in my opinion putting 'this' in everywhere to me just makes things harder to
read.
thanks,
Martin
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders