That is quite strange, since MTASC won't give you an error for your first example, and Flash 8 gives no compile error when i try to use it.

Since you've been using this structure for so long:
function myFunc(tVar:String) {
       if (tVar == undefined) { tVar = "limpet" }
   }

What exactly is the problem it's giving you? I've been using it for 3-4 months (that is without redeclaration) with no problems.

- A

Danny Kodicek wrote:
For, well, pretty much ever, I've worked on the assumption that in this
structure:

function myFunc(tVar:String) {
}

the variable tVar was automatically defined in local scope: that is, I can
write

function myFunc(tVar:String) {
if (tVar == undefined) { tVar = "limpet" }
}

But you know what? That's not true! I've just discovered (and bear in mind,
I've been using that code structure for years) that I have to declare the
variable:

function myFunc(tVar:String) {
if (tVar == undefined) {var tVar:String = "limpet" }
}

That seems really weird to me. Am I wrong? Is there some other explanation?

Danny

_______________________________________________
[email protected]
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

_______________________________________________
[email protected]
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

Reply via email to