Avoiding the word "this" is to avoid easy to understand code

It tells you that a variable is not a local variable but a important one
that's gonna be around to a while ;]


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jon
Bradley
Sent: Friday, October 28, 2005 2:54 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Newbie AS3 question

On Oct 28, 2005, at 1:55 PM, Shaw, Matt wrote:

> Assuming the Game class is your root/stage class:
>
> ....
> Public class Game extends MovieClip {
> public function Game(){
>       var gameworld:MovieClip = new MovieClip(); //new GameWorld()?
>       this.addChild( gameworld );
>
>       var game_bg:MovieClip = new MovieClip();
>       gameworld.addChild( game_bg );
> }

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?

- Jon

_______________________________________________
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

Reply via email to