That still isn't an argument to use them in my opinion, personally I think the 
code is much more convoluted that way. Your argument is essentially it's a 
preference in coding style, not that there are situations that specifically 
call for their use. 

 Jason Merrill
 Instructional Technology Architect II
 Bank of America  Global Learning 
 703.302.9265 (w/h)





_______________________


-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Paul A.
Sent: Wednesday, October 24, 2012 10:19 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] AS3

On 24/10/2012 15:08, Merrill, Jason wrote:
> Ok, what's a good case to use them?  Just curious, I have never found a 
> situation where they were warranted.
Sometimes (depending on what your buttons do), it seems rather artificial to 
have to fabricate a stand-alone function to handle an event when the action 
required is very simple.

I used to always create named event handler functions and realised I was 
adopting some fixed pattern that was actually obfuscating my code unnecessarily 
in some situations.

The OP was using an event handler simply to control the timeline and 
manufacturing a named function to do this very specific thing seems 
unnecessary. With an inline function you can see straight off what happens when 
the event is handled, without looking up the handler function to see what it 
does.
>
>   Jason Merrill
>   Instructional Technology Architect II
>   Bank of America  Global Learning
>   703.302.9265 (w/h)
>
>
>
>
>
> _______________________
>
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com 
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Paul A.
> Sent: Wednesday, October 24, 2012 10:07 AM
> To: Flash Coders List
> Subject: Re: [Flashcoders] AS3
>
> On 24/10/2012 14:43, Merrill, Jason wrote:
>>>> function() { gotoAndStop("divinedivers"); });
>> Yeah, this is weird and unnecessary. Anonymous functions are recommended 
>> against in AS3.
> Really?
>
> I used to be of the same opinion, but certainly not as a blanket rule.
> It all depends.
>
>>    Jason Merrill
>>    Instructional Technology Architect II
>>    Bank of America  Global Learning
>>    703.302.9265 (w/h)
>>
>>
>>
>>
>>
>> _______________________
>>
>> -----Original Message-----
>> From: flashcoders-boun...@chattyfig.figleaf.com 
>> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Paul A.
>> Sent: Wednesday, October 24, 2012 8:33 AM
>> To: Flash Coders List
>> Subject: Re: [Flashcoders] AS3
>>
>> Try removing:
>>
>> button1_btn.mouseChildren = false;
>> button2_btn.mouseChildren = false;
>>
>> Your code is a bit convoluted!
>>
>> divers_btn.addEventListener(MouseEvent.CLICK, function() { 
>> gotoAndStop("divinedivers"); }); 
>> scuba_btn.addEventListener(MouseEvent.CLICK, function() { 
>> gotoAndStop("scubadudes"); });
>>
>> divers_btn.addEventListener(MouseEvent.ROLL_OVER, function() { 
>> divers_btn.gotoAndStop("OVER");});
>> ..
>>
>> Paul
>>
>> On 24/10/2012 12:39, Karl DeSaulniers wrote:
>>> Hello All,
>>> Long time. If your available at the moment, I could use your help 
>>> with some AS3.
>>> I finally got an AS3 job! Yay! But I am stuck on the most simple of 
>>> things.
>>> All I am trying to do is make some buttons work... lol Here is my 
>>> code.
>>>
>>> button1_btn.buttonMode = true;
>>> button2_btn.buttonMode = true;
>>> button1_btn.useHandCursor = true;
>>> button2_btn.useHandCursor = true;
>>> button1_btn.mouseChildren = false;
>>> button2_btn.mouseChildren = false;
>>>
>>> button1_btn.addEventListener(MouseEvent.CLICK, function() { 
>>> changeSelect(1); }); button2_btn.addEventListener(MouseEvent.CLICK,
>>> function() { changeSelect(2); });
>>> button1_btn.addEventListener(MouseEvent.ROLL_OVER, function() { 
>>> toggleB1(2); }); button2_btn.addEventListener(MouseEvent.ROLL_OVER,
>>> function() { toggleB2(2); });
>>> button1_btn.addEventListener(MouseEvent.ROLL_OUT, function() { 
>>> toggleB1(1); }); button2_btn.addEventListener(MouseEvent.ROLL_OUT,
>>> function() { toggleB2(1); });
>>>
>>> function changeSelect(p):void {
>>>           switch (p) {
>>>               case 1:
>>>               this.gotoAndStop("divinedivers"); //goto frame 
>>> divinedivers in this MC
>>>               break;
>>>               case 2:
>>>               this.gotoAndStop("scubadudes"); //got frame scubadudes 
>>> in this MC
>>>               break;
>>>           }
>>> }
>>>
>>> function toggleB1(f):void {
>>>           button1_btn.gotoAndStop(f); //toggle this button MC frame 
>>> }
>>>
>>> function toggleB2(f):void {
>>>           button2_btn.gotoAndStop(f); //toggle this button MC frame 
>>> }
>>>
>>> Why does AS3 have to make things so difficult for something so simple??
>>> What the heck am I doing wrong???
>>>
>>> Also, how do you use just a button instead of a mc?
>>> I tried using just a button and it wouldn't even switch to the over 
>>> state that is inside the button!!?
>>>
>>> AS2 is just so much more simple... sigh*
>>>
>>> TIA,
>>>
>>> Karl DeSaulniers
>>> Design Drumm
>>> http://designdrumm.com
>>>
>>> _______________________________________________
>>> 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
>>
>> ---------------------------------------------------------------------
>> - This message w/attachments (message) is intended solely for the use 
>> of the intended recipient(s) and may contain information that is privileged, 
>> confidential or proprietary. If you are not an intended recipient, please 
>> notify the sender, and then please delete and destroy all copies and 
>> attachments, and be advised that any review or dissemination of, or the 
>> taking of any action in reliance on, the information contained in or 
>> attached to this message is prohibited.
>> Unless specifically indicated, this message is not an offer to sell or a 
>> solicitation of any investment products or other financial product or 
>> service, an official confirmation of any transaction, or an official 
>> statement of Sender. Subject to applicable law, Sender may intercept, 
>> monitor, review and retain e-communications (EC) traveling through its 
>> networks/systems and may produce any such EC to regulators, law enforcement, 
>> in litigation and as required by law.
>> The laws of the country of each sender/recipient may impact the handling of 
>> EC, and EC may be archived, supervised and produced in countries other than 
>> the country in which you are located. This message cannot be guaranteed to 
>> be secure or free of errors or viruses.
>>
>> References to "Sender" are references to any subsidiary of Bank of America 
>> Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are 
>> Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a 
>> Condition to Any Banking Service or Activity * Are Not Insured by Any 
>> Federal Government Agency. Attachments that are part of this EC may have 
>> additional important disclosures and disclaimers, which you should read. 
>> This message is subject to terms available at the following link:
>> http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you 
>> consent to the foregoing.
>> _______________________________________________
>> 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
>
> ----------------------------------------------------------------------
> This message w/attachments (message) is intended solely for the use of the 
> intended recipient(s) and may contain information that is privileged, 
> confidential or proprietary. If you are not an intended recipient, please 
> notify the sender, and then please delete and destroy all copies and 
> attachments, and be advised that any review or dissemination of, or the 
> taking of any action in reliance on, the information contained in or attached 
> to this message is prohibited.
> Unless specifically indicated, this message is not an offer to sell or a 
> solicitation of any investment products or other financial product or 
> service, an official confirmation of any transaction, or an official 
> statement of Sender. Subject to applicable law, Sender may intercept, 
> monitor, review and retain e-communications (EC) traveling through its 
> networks/systems and may produce any such EC to regulators, law enforcement, 
> in litigation and as required by law.
> The laws of the country of each sender/recipient may impact the handling of 
> EC, and EC may be archived, supervised and produced in countries other than 
> the country in which you are located. This message cannot be guaranteed to be 
> secure or free of errors or viruses.
>
> References to "Sender" are references to any subsidiary of Bank of America 
> Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are 
> Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a 
> Condition to Any Banking Service or Activity * Are Not Insured by Any Federal 
> Government Agency. Attachments that are part of this EC may have additional 
> important disclosures and disclaimers, which you should read. This message is 
> subject to terms available at the following link:
> http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you 
> consent to the foregoing.
> _______________________________________________
> 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

----------------------------------------------------------------------
This message w/attachments (message) is intended solely for the use of the 
intended recipient(s) and may contain information that is privileged, 
confidential or proprietary. If you are not an intended recipient, please 
notify the sender, and then please delete and destroy all copies and 
attachments, and be advised that any review or dissemination of, or the taking 
of any action in reliance on, the information contained in or attached to this 
message is prohibited. 
Unless specifically indicated, this message is not an offer to sell or a 
solicitation of any investment products or other financial product or service, 
an official confirmation of any transaction, or an official statement of 
Sender. Subject to applicable law, Sender may intercept, monitor, review and 
retain e-communications (EC) traveling through its networks/systems and may 
produce any such EC to regulators, law enforcement, in litigation and as 
required by law. 
The laws of the country of each sender/recipient may impact the handling of EC, 
and EC may be archived, supervised and produced in countries other than the 
country in which you are located. This message cannot be guaranteed to be 
secure or free of errors or viruses. 

References to "Sender" are references to any subsidiary of Bank of America 
Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are 
Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a 
Condition to Any Banking Service or Activity * Are Not Insured by Any Federal 
Government Agency. Attachments that are part of this EC may have additional 
important disclosures and disclaimers, which you should read. This message is 
subject to terms available at the following link: 
http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you 
consent to the foregoing.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to