RE: [flexcoders] Duplicate variable definition
ActionScript doesn't have (and has never had) block-scoped variables. When you declare a local variable anywhere in a method, it is as if you had declared it at the top, and it is accessible anywhere in the method. Therefore having two declarations is redundant. The new warning is trying to make people aware of this (probably unexpected) behavior. In your case of two for-loops, the coding standards we use in the framework classes would do it like this: var i:int; for (i = 0; i < 10; i++) { ... } for (i = 0; i < 10; i++) { ... } - Gordon From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dirk Eismann Sent: Wednesday, June 28, 2006 2:46 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Duplicate variable definition yes. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jonas Windey Sent: Wednesday, June 28, 2006 11:29 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Duplicate variable definition Hi, In flex 2 b3, it was allowed to do this: rivate function fcnTest():void { for (var i:Number=0;i< 10;i++){ //do sthing } for (var i:Number=0;i< 10;i++){ //do something more } } In 2.0 final, I get Duplicate variable definition. Should I only declare it once before every loop? Jonas __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [flexcoders] Duplicate variable definition
yes. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jonas WindeySent: Wednesday, June 28, 2006 11:29 AMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Duplicate variable definition Hi, In flex 2 b3, it was allowed to do this: rivate function fcnTest():void { for (var i:Number=0;i< 10;i++){ //do sthing } for (var i:Number=0;i< 10;i++){ //do something more } } In 2.0 final, I get Duplicate variable definition. Should I only declare it once before every loop? Jonas __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Duplicate variable definition
On Wednesday 28 June 2006 10:29, Jonas Windey wrote: > Should I only declare it once before every loop? Or just once at the start of the method. -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. We are pleased to announce that Halliwells LLP has been voted AIM Lawyer of the Year at the 2005 Growth Company Awards Yahoo! Groups Sponsor ~--> Yahoo! Groups gets a make over. See the new email design. http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM ~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/