Duplicate MovieClip in AIR / AS3

Has anyone noticed how creating new instances of MovieClip (and probably other objects) in AIR causes some weird effects? If you use the Senocular method , capturing the object constructor and creating a new MovieClip instance, you will get a new MovieClip with 0 frames. I don’t want to draw the bitmapData of each frame into an array, does anyone have a suggestion to make a real duplicate of MovieClip? (i.e. not just a strong link).

+3
source share
2 answers

I personally used flash.utils:

getQualifiedClassName(value:*):String

and

getDefinitionByName(name:String):Object

And instantiate using the Class object

, , Senocular , , , , , , - , .

+2

-, getDefinition/getDefinitionByName/object contructor Adobe AIR (3.7, , ).

var movieClipShallow : MovieClip = loader.getMovieClip(url);
var constructor: Class = (movieClipShallow as Object).constructor;
var anotherInstance: MovieClip = new constructor();

movieClipShallow //numFrames/etc. anotherInstance

: (

0

Source: https://habr.com/ru/post/1703255/


All Articles