OOOh, indeed, that would be a bad choice.

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Paul Andrews
Sent: vrijdag 8 januari 2010 13:16
To: Flash Coders List
Subject: Re: [Flashcoders] Declaring Function Variables

Cor wrote:
> Mmmm, I have never experienced any problems with it.
>   
It just means you havent used the same variable in a loop with nested 
functions that are also using the variable.
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Paul
Andrews
> Sent: vrijdag 8 januari 2010 12:47
> To: Flash Coders List
> Subject: Re: [Flashcoders] Declaring Function Variables
>
> Cor wrote:
>   
>> Declaring it within a function will make the variable LOCAL (= usage in
>>     
> that
>   
>> function only).
>> You only declare it outside, once and (re)use it as often as you like.
>>   
>>     
> I would advise that it's best to avoid doing that. Most of the time it 
> won't give you a problem, but then you'll spend some time trying to find 
> out why that function call is messing up the loop count of the code it's 
> called in.
>   
>> HTH
>> Cor
>>
>> -----Original Message-----
>> From: flashcoders-boun...@chattyfig.figleaf.com
>> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of David
>>     
> Benman
>   
>> Sent: vrijdag 8 januari 2010 12:16
>> To: Flash Coders List
>> Subject: [Flashcoders] Declaring Function Variables
>>
>> What's the best practice for declaring reused variables within a  
>> function in AS3? For example, if you use "count" several times in your  
>> function, if you declare it at the start of your function, "var  
>> count:Number;" it makes it harder to cut and paste your code for use  
>> elsewhere but you get errors if redeclare it (like you could in AS2)  
>> throughout your script.
>>
>>
>> David Benman
>> Interactive Developer
>> d...@dbenman.com
>> http://www.dbenman.com
>> (508) 954-1202 (cell)
>> (315) 637-8487 (home office)
>>
>>
>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com 
>> Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date:
>>     
> 01/07/10
>   
>> 08:35:00
>>
>> _______________________________________________
>> 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
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date:
01/07/10
> 08:35:00
>
> _______________________________________________
> 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
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date: 01/07/10
08:35:00

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to