HomeAbout

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:
  1. 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( ).
  2. // However, you can also specify additional parameters to pass along to the method.
  3. lvInstance.onData = ascb.utils.Proxy.create(this, assignText, "some property value");
  4. lvInstance.load(sURL);
  5.  
  6. }
  7.  
  8. private function assignText(sText:String, sAnotherParameter:String):Void {
  9.  
  10. _sProperty = sText;
  11.  
  12. // Much simpler.
  13.  
  14. trace(sAnotherParameter);
  15.  
  16. }
  17.  
  18. }</div>
  19. <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

Leave a comment





XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .