Alright, so I’m trying out AS3.0, or learning to and I got some questions, which I think should be (and probably are) easy to do.
Say I have an .as class file “Animal”
and in the Library I have MCs - “Cat”, “Dog”
in AS2.0 - the MC in the library would have the class of “Animal” and I’d use
attachMovie(“Cat”, …) or attachMovie(“Dog”, …) and it would reference the functions/script of the “Animal” .as Class.
Now from what I understand,
in AS3.0 - the MC in the library would have the class as “Cat” or “Dog” and I’d change the base class to “Animal” (and have my Animal.as ‘class Animal extends MovieClip’)
Least that’s how I think it works.
Now let’s say in my library I have “Cat1”, "Cat2’, “Cat3” and I wanted to attach these to the stage through a function
in AS2.0
createCat(catType:String){
this.attachMovie(catType,…)
}
and I’d just call createCat(“Cat2”)
How do I achieve the same thing in AS3.0? one way would be to have a ‘switch’ for the variable and then just call the appropriate new Cat1, new Cat2 and so on, but that’s clearly not the right way.
The other thing is, say my Animal class has a constructor that takes in some parameters
public function Animal(name:String)
how do I make something like…
var cat = new Cat1(“Bobby”) ?
Sorry for the long post and potentially stupid question
Thanks