This content has been marked as final. Show 3 replies
this.box.onPress = function()
//this.box._visible = false;
this._visible = false;
// within the onPress handler, 'this' IS the box
Aha! That did the trick. I have one other question if you don't mind. It seems that I am unable to embed functions in the onPress event handler function. I get an error about unknown variable when I try. Is there another way to do what I'm trying to that would allow me to click a movieClip on the stage and from that click call another function embedded within the same press function?
I'm in the midst of converting a ton of as3 code down to as2 where I just used addEventListeners to manipulate all the movieClips on the stage. As2 has another method called addListener but it doesn't seem to function like its as3 counter part. Below I have a code snipet from as3 that I would like to achieve in as2.
Again, any help on this matter would be most appreciated!
Oh, thanks for you post dsdsdsdsd!!!
Well looks like I solved my own question. For those that were wondering it looks like using 'onPress' eventHandlers inside a function places the 'onPress' event out of scope of the class to the point where you're unable to access properties and/or methods.
I rewrote my little test code with this in mind and utilized the Delegate class in what can deem as a sort of as3 addEventListener for as2. I have listed the code below: