开发者

Using external movieclips in Flash CS4 (Actionscript 3)

I'm building a Flash CS4 application (AS3) and I can't keep all my movie clips in the library because there will be hundreds of them, and new ones will be added all the time.

Two parts to the question:

  1. How can I externally load in a movieclip to use during run time? After loading I still need to be able to manipulate it as if I created a new instance of it 开发者_开发技巧from the internal library.

  2. How can I load a movieclip based on its name?

Thanks!


  • To load a movie clip at runtime use the Loader and URLRequest classes. Listen to the Event.Complete to know when it is ready to be used.

  • To instanciate a Class at runtime use the function getDefinitionByName or getDefinition

Look at a complete example (mixing the different concept) in the current doc


you can't load movieclips, like you know them form the library panel, at runtime (because they can't exist without a container format like .swf). but you can load other .swf files that contain those MovieClips via the Loader class. You also can create a new instance of a Class, at runtime, that extends the MovieClip Class, but i don't think this will be helpful for you, because this class would have to be inside the library as well (or at least imported with actionscript), even though you don't use it at the stage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜