Search code examples
flashactionscript-3air

Duplicate MovieClip in AIR/AS3


Has anyone noticed how creating new instances of a MovieClip (and likely other objects as well) in AIR causes some strange effects? If you use Senocular's method by grabbing the object constructor and creating a new instance of the MovieClip, you end up with a new MovieClip with 0 frames. I don't want to draw bitmapData's of every frame into an array, does anyone have a suggestion for making a real duplicate of a MovieClip? (i.e. not just a strong reference).


Solution

  • i'd personally use flash.utils:

    getQualifiedClassName(value:*):String
    

    and

    getDefinitionByName(name:String):Object
    

    And create an instance using the Class object

    I'm sure there may be a reason why Senocular has used this method, but it may be worth trying replacing that line using these two methods to see if it solves any issues you are having.