# "this" reference with buttonInstance.onPress?

**URL:** <https://forum.kirupa.com/t/this-reference-with-buttoninstance-onpress/51218>\
**Category:** flash\
**Created:** [May 11, 2004, 12:50am UTC](https://forum.kirupa.com/t/this-reference-with-buttoninstance-onpress/51218 "2004-05-11T00:50:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jantom](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jantom](https://forum.kirupa.com/u/jantom)\
**Post date:** [May 11, 2004, 12:50am UTC](https://forum.kirupa.com/t/this-reference-with-buttoninstance-onpress/51218/1 "2004-05-11T00:50:42Z")

</div>

I have a button on the main timeline, its instance name is “btButton”.

1. 

If I put:  
“btButton.onPress function { **this**.attachMovie(…etc…);}”  
nothing happens.

I need to refer to “ **this.\_parent** ”. Why?  
I thought that since the button was on the main timeline, “this” should refer to the main timeline.

Again:  
"btButton.onPress function { **this**.\_alpha=10;}  
changes the alpha property of the button, while  
“btButton.onPress function { **this.\_parent**.\_alpha=10;}” changes the alpha property of the \_root.

1. 

“this.\_parent.attachMovie(…)” works.  
“ **\_parent**.attachMovie(…)” doesn’t work. Why?
