PDA

View Full Version : Silly Syntax Question


chuchanche
02-08-2006, 11:47 PM
I'm very new to Actionscript 2.0, and I'm wondering how to make the following AS 1.0 variable definition work using AS 2.0

this["variable"+"1"] = "This is the first variable";
trace(variable1);

Here's my best guest (which DOESN'T work)

var this["variable"+"2"]:String = "This is the second variable";
trace(variable2);

deadbeat
02-08-2006, 11:49 PM
Your first approach should work fine.

You just can't strict type dynamic variables in AS2, which is why the second one doesn't work...

K.

chuchanche
02-09-2006, 12:01 AM
Thank you very much.

I guess I was just trying TOO hard to be compliant :)