For example:
var myObj={
myValue="hola",
asMember=function(){ alert( this.myValue ); }
};
myObj.asMember(); // will work fine
var asGlobal=myObj.asMember; // global alias for that member function
asGlobal(); // won't work in javascript (will work in AS3, but i need js now)
So the question is, can I rewrite asMember
so that it could be called by global alias and without mentioning myObj
at all? It's understood that if I define it:
asMember=function(){ alert( myObj.myValue ); }
it will work, but in my case, mentioning myObj
is not acceptable even inside the function itself (because myObj
may be reassigned later, but asGlobal
won't change and should keep working)