RE: [Flashcoders] Delegate question...
You don't. Therein lies the rub with Macromedia's Delegate class. But there is a semi-ugly way you could if you want to. Not that I recommend this method (though I have used it lots in the past with no issues, but I think it's better to go with Muzak's suggestion) myDel:Object = myClip.onRelease = Delegate.create(this, myReleaseHandler) myDel.myProperty = hello function myReleaseHandler():Void { trace(arguments.caller.myProperty) } Jason Merrill Bank of America GTO LLD Solutions Design Development eTools Multimedia Bank of America Flash Platform Developer Community -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks Sent: Friday, February 01, 2008 7:19 PM To: Flash Coders List Subject: Re: [Flashcoders] Delegate question... You don't. Therein lies the rub with Macromedia's Delegate class. Use Big Spaceship's Improved Delegate class http://labs.bigspaceship.com/blog/?p=9 [p e r c e p t i c o n] wrote: 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Delegate question...
oh yes...of course! i haven't done that in such a long time i forgot about it :) thanks to all On Feb 4, 2008 7:21 AM, Merrill, Jason [EMAIL PROTECTED] wrote: You don't. Therein lies the rub with Macromedia's Delegate class. But there is a semi-ugly way you could if you want to. Not that I recommend this method (though I have used it lots in the past with no issues, but I think it's better to go with Muzak's suggestion) myDel:Object = myClip.onRelease = Delegate.create(this, myReleaseHandler) myDel.myProperty = hello function myReleaseHandler():Void { trace(arguments.caller.myProperty) } Jason Merrill Bank of America GTO LLD Solutions Design Development eTools Multimedia Bank of America Flash Platform Developer Community -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks Sent: Friday, February 01, 2008 7:19 PM To: Flash Coders List Subject: Re: [Flashcoders] Delegate question... You don't. Therein lies the rub with Macromedia's Delegate class. Use Big Spaceship's Improved Delegate class http://labs.bigspaceship.com/blog/?p=9 [p e r c e p t i c o n] wrote: 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 ___ 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
Re: [Flashcoders] Delegate question...
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
Re: [Flashcoders] Delegate question...
you guys are indeed the best many thanks p On Feb 2, 2008 5:28 AM, EECOLOR [EMAIL PROTECTED] wrote: 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Delegate question...
You can use an event proxy such as Grant Skinner's: http://www.gskinner.com/blog/archives/2004/05/source_code_eve.html - Randy On Feb 2, 2008 10:52 AM, [p e r c e p t i c o n] [EMAIL PROTECTED] wrote: you guys are indeed the best many thanks p On Feb 2, 2008 5:28 AM, EECOLOR [EMAIL PROTECTED] wrote: 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 ___ 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] 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
Re: [Flashcoders] Delegate question...
You don't. Therein lies the rub with Macromedia's Delegate class. Use Big Spaceship's Improved Delegate class http://labs.bigspaceship.com/blog/?p=9 [p e r c e p t i c o n] wrote: 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
Re: [Flashcoders] Delegate question...
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