The way you've written it it wouldn't have worked in pre-AS3 either.
You can't declare a variable in that manner.
For example:
var this.myObj:Object = new Object();
would not work. It would have to look like:
this.myObj = new Object();
"var" is for declaring a variable in the current scope and you can't
set the type of a property of an object as you are doing, AS2 or AS3.
This should work, or at least not give you compiler errors:
for(var i:Number=0; i<mData.length; i++){
this["rAsset" + mData[i].ToString()] = new AssetProxy( mData[i] );
}
On Fri, Apr 18, 2008 at 8:20 AM, justSteve <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> I think this is a fairly common operation - a loop instantiates an
> object passing the iterator variable to the constructor. The object
> being instantiated needs to take it's name from the current iterator.
>
> for(var i:Number=0; i<mData.length; i++){
> var how2NameMe :IStartupProxy = new AssetProxy( mData[i] );
> }
>
> In pre-AS3 days i'd do something like:
>
> var this["rAsset" + mData[i].ToString()] :StartupResourceProxy =
> makeAndRegisterStartupResource( SRNAME , this);
>
> That seems not to be an option anymore.
>
> mny thx
> --steve...
>
--
Derek Vadneau