Apache flex 显示同一外部电影剪辑的多个副本

Apache flex 显示同一外部电影剪辑的多个副本,apache-flex,actionscript-3,graphics,Apache Flex,Actionscript 3,Graphics,在多个图像之间共享位图数据很容易: // target and source are instances of the mx.controls.Image class var content_copy:Bitmap = new Bitmap((source.content as Bitmap).bitmapData); target.load(content_copy); 但是如何使用矢量图形对电影剪辑执行相同的操作呢? 我发现的唯一方法是使用另一个电影剪辑的字节数据作为源加载电影剪辑 tar

在多个图像之间共享位图数据很容易:

// target and source are instances of the mx.controls.Image class
var content_copy:Bitmap = new Bitmap((source.content as Bitmap).bitmapData);
target.load(content_copy);
但是如何使用矢量图形对电影剪辑执行相同的操作呢? 我发现的唯一方法是使用另一个电影剪辑的字节数据作为源加载电影剪辑

target.load(source.content.loaderInfo.bytes);

但是它实际上复制了内容。

没有办法共享内容(在ActionScript内存中,我不确定它是否发生在运行时内存中),但是如果您只是想避免加载两次,您现有的加载字节的解决方案是最好的解决方案

但是,如果MovieClip不需要交互,则可以将其绘制到BitmapData并共享该BitmapData。显然,这是否真正优化了内存配置文件取决于您需要多少实例以及向量数据的复杂性