[英]AS3 - How to create a new MovieClip from externally loaded SWF
I am exporting my animated characters from Flash Professional as a SWF to externally load them into AS3. 我正在从Flash Professional中将动画角色导出为SWF,以将其从外部加载到AS3中。 I do not want to export them as SWC's because I have hundreds of these characters and only a small portion of them will be used at a given time.
我不想将它们导出为SWC,因为我有数百个这样的字符,并且在给定时间仅会使用其中的一小部分。
It seems impossible to create multiple of these character MovieClips from the same loaded SWF since they are not SWC's I have no ActionScript linkage to be able to say 由于它们不是SWC,因此似乎不可能从同一加载的SWF中创建多个此类MovieClip,因为我没有ActionScript链接可以说
var myClip:MovieClip = new MyMovieClip();
I need to be able to make separate MovieClips from this same loaded character SWF. 我需要能够从此相同的已加载角色SWF中制作单独的MovieClip。 I essentially want to be able to say
我本质上希望能够说
var newMovieClip:MovieClip = otherMovieClip.clone();
Can this be done? 能做到吗?
Would you be able to try this: 您可以尝试以下方法:
var newMovieClip:MovieClip = new (otherMovieClip as Object).constructor()
or 要么
var className:String = getQualifiedClassName(otherMovieClip);
if(className)
{
var _class:Class = getDefinitionByName(className);
if(_class)
{
newMovieClip = new _class;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.