Imagine I have an FLA with a movieclip and inside it there is another movieclip called button_mc, the main movieclip is associated with class a.
for class a II will write an external class, which goes something like the one attached.
when button_mc.on_release is dispatched the event handler can use the class variables or call to a class function..
the problem is the this keyword now relates to button_mc inside the event handler and even inside the class functions that get called by button_mc.onRelease..
this takes out the benefit of using the this keyword and makes the code invalid.... since it is wrongly addresses another movieclip then the one intended to...
the only solution I found was to replace the this keyword with an absolute addressing... but that is ugly..
what is the correct way to handle this ?
class a extends movieclip
private var var1:Number
function a ()
this.button_mc.onRelease = _handle_button_mc_onRelease;
function a2 (n)
this.var1 = n;
function _handle_button_mc_onRelease ()
// this wont work anymore
var i = this.var1;
// this call will not work and even if it did
// a2 inner code would not work because of the
// this keyword