First off I want to say that the resources on this site have been excellent, thanks.
Does anyone know how to reference a variable when adding a new Movieclip?
Currently I am using this method:
var myVariable:String = "one"
if(myVariable == "one"){
var myMovieClip = this.addChild(new one())
}
else if(myVariable == "two"){
var myMovieClip = this.addChild(new two())
}
else if(myVariable == "three"){
var myMovieClip = this.addChild(new three())
}
etcetera.
I was wondering if there was a way to just have it put the variable in to the addChild argument, meaning I could do away with all the ifs to check what the variable is.
e.g.
var myVariable:String = "one"
var myMovieClip = this.addChild(new >>whatever myVariable is<<())
I tried doing a search, but had no idea what to search for, so I didn’t find anything.