class fly.Delegate extends Object
{
   static function create(obj:Object, func:Function):Function
   {
      var returnFunction = function()
      {
         var self:Function = arguments.callee;
         var target_obj:Object = self.target_obj;
         var func:Function = self.func;
         var userArguments_array:Array = self.userArguments_array;
         return func.apply(target_obj, arguments.concat
(userArguments_array));
      };

      returnFunction.target_obj = obj;
      returnFunction.func = func;
      returnFunction.userArguments_array = arguments.splice(2);
      return returnFunction;
   }
};



Greetz Erik


On 2/2/08, Muzak <[EMAIL PROTECTED]> wrote:
>
> You don't and should never have to.
> Create a custom button (MovieClip+Class) that dispatches an event (e.g.
> "release"), rather than using a generic Button/MovieClip
> symbol.
> So instead of:
>
>     someMC.onRelease = Delegate.create(_level0, doSomething);
>
> you'd then use:
>
>     function doSomething(o:Object):Void {
>         trace(o.target);
>     }
>     someMC.addEventListener("release", Delegate.create(this,
> doSomething));
>
> regards,
> Muzak
>
> ----- Original Message -----
> From: "[p e r c e p t i c o n]" <[EMAIL PROTECTED]>
> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
> Sent: Saturday, February 02, 2008 1:02 AM
> Subject: [Flashcoders] Delegate question...
>
>
> > Howdy,
> > Quick question...How can I pass vars if i'm using delegates for
> handlers....
> > I have it set up like so...
> >
> >
> > someMC.onRelease = Delegate.create(_level0, doSomething);
> >
> > what i want to be able to do is know which instance of someMC actually
> > called it...
> >
> > thanks
> >
> > p
>
> _______________________________________________
> 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

Reply via email to