Cruiser
February 20th, 2004, 04:49 AM
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.
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.
}
}
Thanks a lot.
Cruiser.
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.
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.
}
}
Thanks a lot.
Cruiser.