-1

I have three movieClips are mc1, mc2 and mc3. It is simple to add a movie clip from library dynamically with its class name. This method requares different class names for all movieClips that I want to add. The problem is "control.as" file. I need to define a same class name to control all atached movie with the same "control.as" file. How can I define same class name as "control" and then I can add them dynamically?

for(var i=1;i<=3;i++){
   var parameter="mc"+i
   ...?
   ...?
   ...?
}
  • Possible duplicate of [Can I create an instance of a class from AS3 just knowing his name?](http://stackoverflow.com/questions/7597343/can-i-create-an-instance-of-a-class-from-as3-just-knowing-his-name) – null May 14 '16 at 12:45
  • You can have different class names and construct the class Name dynamically with `getDefinitionByName()`, see http://stackoverflow.com/q/7597343/4347580 – null May 14 '16 at 12:47
  • But I can control mc with an "control.as" file. So.. It is necessary to give same class name. Isnt it? So it seems I cant use different class names. – Erkan Çamyar May 14 '16 at 14:15

1 Answers1

0

Set control.as as the base class of the individual library symbols and give each one a unique class name.

This way they all share the behavior of the base class but can be uniquely identified and added to the display list by their class name.

null
  • 5,207
  • 1
  • 19
  • 35