# Using "this"

**URL:** https://forum.kirupa.com/t/using-this/316271
**Category:** Uncategorized
**Created:** [November 17, 2010, 2:32pm UTC](https://forum.kirupa.com/t/using-this/316271 "2010-11-17T14:32:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ThreeDollarBill](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@ThreeDollarBill](https://forum.kirupa.com/u/ThreeDollarBill)
#### Post date: [November 17, 2010, 2:32pm UTC](https://forum.kirupa.com/t/using-this/316271/1 "2010-11-17T14:32:16Z")

</div>

hey… I just want to know… is there an advantage / disadvantage to using “this”… for example…

this makes use of “this”:

```php
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:

```php
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?
