# Class member passing onPress problem

**URL:** <https://forum.kirupa.com/t/class-member-passing-onpress-problem/43256>\
**Category:** flash\
**Created:** [February 20, 2004, 9:49am UTC](https://forum.kirupa.com/t/class-member-passing-onpress-problem/43256 "2004-02-20T09:49:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cruiser](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Cruiser](https://forum.kirupa.com/u/Cruiser)\
**Post date:** [February 20, 2004, 9:49am UTC](https://forum.kirupa.com/t/class-member-passing-onpress-problem/43256/1 "2004-02-20T09:49:21Z")

</div>

Hi board,

I have a class which controls a movie clip. The movie clip has a button in it. The problem is that I cannot use the class members in the onPress function of the button.

[AS]  
class Controller {  
private var id:Number; // I have tried public also  
private var myClip:MovieClip; // The clip that has the button

public function Controller() {  
// I have got the reference to the MovieClip that contains the  
// button.

myClip.myButton.onPress = doSomething;  
}

public function doSomething() {  
trace(this.id); // \<— does not work. I tried without _this_  
// the function is being called so thats not a problem  
// Only the _id_ is not accessible.  
}  
}  
[/AS]

Thanks a lot.

Cruiser.
