Proxy
Flash's Delegate class doesn't allow you to pass extra parameters to a method when using Delegate.create(). Use the Proxy class instead.
http://www.person13.com/articles/proxy/Proxy.htm
Actionscript:
-
class SomeClass {private var _sProperty:String;public function SomeClass(sURL:String) {var lvInstance:LoadVars = new LoadVars();// The syntax for ascb.utils.Proxy.create( ) is similar to that of Delegate.create( ).
-
// However, you can also specify additional parameters to pass along to the method.
-
lvInstance.onData = ascb.utils.Proxy.create(this, assignText, "some property value");
-
lvInstance.load(sURL);
-
-
}
-
-
private function assignText(sText:String, sAnotherParameter:String):Void {
-
-
_sProperty = sText;
-
-
// Much simpler.
-
-
trace(sAnotherParameter);
-
-
}
-
-
}</div>
-
<div>
No Comments »
RSS feed for comments on this post.
| TrackBack URI
You can also bookmark
this on del.icio.us or check the cosmos