hey… I just want to know… is there an advantage / disadvantage to using “this”… for example…
this makes use of “this”:
package
{
import flash.display.Sprite;
import flash.events.Event;
public class TestClass extends Sprite
{
public function TestClass()
{
this.addEventListener(Event.ADDED_TO_STAGE, init);
}
function init(event:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, init);
this.addEventListener(Event.ENTER_FRAME, update);
}
function update(event:Event):void
{
trace(this.x, this.y);
}
}
}
this doesn’t:
package
{
import flash.display.Sprite;
import flash.events.Event;
public class TestClass extends Sprite
{
public function TestClass()
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
function init(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
addEventListener(Event.ENTER_FRAME, update);
}
function update(event:Event):void
{
trace(x, y);
}
}
}
but they both achieve the same thing…
so what exactly is the difference between the two?