I think is one of them (Joey Lott?)
class ascb.util.Proxy {
public static function create(oTarget:Object,
fFunction:Function):Function {
// Create an array of the extra parameters passed to the method.
Loop
// through every element of the arguments array starting with
index 2,
// and add the element to the aParameters array.
var aParameters:Array = new Array();
for(var i:Number = 2; i < arguments.length; i++) {
aParameters[i - 2] = arguments[i];
}
// Create a new function that will be the proxy function.
var fProxy:Function = function():Void {
// The actual parameters to pass along to the method called by
proxy
// should be a concatenation of the arguments array of this
function
// and the aParameters array.
var aActualParameters:Array = arguments.concat(aParameters);
// When the proxy function is called, use the apply( ) method
to call
// the method that is supposed to get called by proxy. The
apply( )
// method allows you to specify a different scope (oTarget)
and pass
// the parameters as an array.
fFunction.apply(oTarget, aActualParameters);
};
// Return the proxy function.
return fProxy;
}
}
On Nov 7, 2005, at 12:29 PM, JesterXL wrote:
You can use Proxy; ARP has one, and a few other Proxy's have been
written
that support this.
Anyone have the links to those handy?
----- Original Message -----
From: "Eric E. Dolecki" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Monday, November 07, 2005 12:25 PM
Subject: Re: [Flashcoders] scope in classes
Any way of passing a param through that? I think no
On Nov 7, 2005, at 12:20 PM, JesterXL wrote:
Use Delegate. Not sure why your's is scoping wrong, but always
worked for
me.
attachMovie("SomeClip", "mc", 0);
mc.onRelease = Delegate.create(this, onMyRelease);
function onMyRelease()
{
// scoped to class, not mc
}
----- Original Message -----
From: "Eric E. Dolecki" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Monday, November 07, 2005 12:11 PM
Subject: [Flashcoders] scope in classes
Wondering what the best way to scope mc event functions to a function
in a class is...
lets say in the class init (this is for a component), you attach some
mcs.
Then you want to have onRelease functions that scope back down to a
private function to handle that. Whats the best way to do that
without nesting functions and keeping scope? Delegate.create(this,
funcName) ends up scoping to the mc in question.
ed
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders