# Referencing objects using ´this´ from inside a function, concept not well understande

**URL:** <https://forum.kirupa.com/t/referencing-objects-using-this-from-inside-a-function-concept-not-well-understande/323131>\
**Category:** flash\
**Created:** [June 18, 2011, 4:40am UTC](https://forum.kirupa.com/t/referencing-objects-using-this-from-inside-a-function-concept-not-well-understande/323131 "2011-06-18T04:40:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joecoolman](https://avatars.discourse-cdn.com/v4/letter/j/a88e4f/32.png) [@joecoolman](https://forum.kirupa.com/u/joecoolman)\
**Post date:** [June 18, 2011, 4:40am UTC](https://forum.kirupa.com/t/referencing-objects-using-this-from-inside-a-function-concept-not-well-understande/323131/1 "2011-06-18T04:40:24Z")

</div>

Friends help me

I understand this, \_parent keywords and its usage but I don’t understand the following:

MovieClip.prototype.move = function() {

function toRight() {  
this.\_x=50;  
trace(this.\_name);  
}  
toRight();

};

Then, I use the move function the onRollOver event on certain movieClips. The tracer output is ‘undefined’ and the object doesn’t move when I put the mouse over. Friends, tell me why the ‘this’ inside the function doesn’t reference to the object which the code is applying? If I put this.\_x=50; outside the function toRight() it’s ok. Please, don’t tell workarounds to get the same effect, I want to know why ‘this’ lose its reference inside the function toRight(). I am learning in Flash Professional 8.0:trout:
