RE: [Flashcoders] btn action function with params
Put simply, I just wanted to be able to call a function from a button action in one line of code without having to add a new function() action after the button. That's called an anonymous function, which it sounds like you don't want. So then, you can do this: function myFunction(){ } myBtn.onRelease = myFunction Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] btn action function with params
Just a small thing that I've always wondered... When you assign a function name to a button action, is there a way to send parameters to this function? eg. function doStuff(mc){ trace(mc); } //Option1. this is a short way of targeting the above function my_btn.onRelease = doStuff; //Option2. but you can't send parameters my_btn.onRelease = doStuff(mc); //does not work //Option 3. Usually I have to do this... my_btn.onRelease = function(){ doStuff(mc); //does not work } I know it's no biggie, but it would be nice to do option 2 somehow - Mick ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] btn action function with params
One way: function doStuff(mc){ trace(mc); } my_btn.clip = mc my_btn.onRelease = function(){ doStuff(this.clip); } Might also be a preferred to do with Delegate.create() Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Mick G Sent: Friday, September 29, 2006 2:29 PM To: Flashcoders mailing list Subject: [Flashcoders] btn action function with params Just a small thing that I've always wondered... When you assign a function name to a button action, is there a way to send parameters to this function? eg. function doStuff(mc){ trace(mc); } //Option1. this is a short way of targeting the above function my_btn.onRelease = doStuff; //Option2. but you can't send parameters my_btn.onRelease = doStuff(mc); //does not work //Option 3. Usually I have to do this... my_btn.onRelease = function(){ doStuff(mc); //does not work } I know it's no biggie, but it would be nice to do option 2 somehow - Mick ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] btn action function with params
I'm not sure that's really what I was after... Put simply, I just wanted to be able to call a function from a button action in one line of code without having to add a new function() action after the button. So just this (but sending a param to a function called doStuff)... my_btn.onRelease = doStuff; Withough having to go: my_btn.onRelease = function(){ doStuff(myParam); } On 9/29/06, Merrill, Jason [EMAIL PROTECTED] wrote: One way: function doStuff(mc){ trace(mc); } my_btn.clip = mc my_btn.onRelease = function(){ doStuff(this.clip); } Might also be a preferred to do with Delegate.create() Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Mick G Sent: Friday, September 29, 2006 2:29 PM To: Flashcoders mailing list Subject: [Flashcoders] btn action function with params Just a small thing that I've always wondered... When you assign a function name to a button action, is there a way to send parameters to this function? eg. function doStuff(mc){ trace(mc); } //Option1. this is a short way of targeting the above function my_btn.onRelease = doStuff; //Option2. but you can't send parameters my_btn.onRelease = doStuff(mc); //does not work //Option 3. Usually I have to do this... my_btn.onRelease = function(){ doStuff(mc); //does not work } I know it's no biggie, but it would be nice to do option 2 somehow - Mick ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] btn action function with params
Hi, other way: my_btn.onRelease = Proxy.create (this, this.doStuff, param1, param2, param3); The Proxy class can be found through google. greetz JC On 9/29/06, Merrill, Jason [EMAIL PROTECTED] wrote: One way: function doStuff(mc){ trace(mc); } my_btn.clip = mc my_btn.onRelease = function(){ doStuff(this.clip); } Might also be a preferred to do with Delegate.create() Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Mick G Sent: Friday, September 29, 2006 2:29 PM To: Flashcoders mailing list Subject: [Flashcoders] btn action function with params Just a small thing that I've always wondered... When you assign a function name to a button action, is there a way to send parameters to this function? eg. function doStuff(mc){ trace(mc); } //Option1. this is a short way of targeting the above function my_btn.onRelease = doStuff; //Option2. but you can't send parameters my_btn.onRelease = doStuff(mc); //does not work //Option 3. Usually I have to do this... my_btn.onRelease = function(){ doStuff(mc); //does not work } I know it's no biggie, but it would be nice to do option 2 somehow - Mick ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com