How do I use AS3 to embed an SWF file and control is using .play()?

只谈情不闲聊 提交于 2019-12-13 18:01:10

问题


I have a folder "/assets/animations" filled with .swf files. I would like my AS3 script to embed all these assets so they can be later called to play or stop.

I hear a lot about the Loader class but it looks like it doesn't embed all the files at compile time but rather grab them from a url when needed.

Basically these assets are cut scenes for a flash game. I would like all of them to be present in one final .swf so its easy to play on any machine without an internet connection.


回答1:


[Embed(source="scene1.swf", symbol="scene1ID")]
public var Scene1:Class;

private var scene1:MovieClip = new Scene1();
scene1.play(); 

This should help you... http://www.bit-101.com/blog/?p=853




回答2:


no, you cannot dynamically use the embed metadata command. it's actually more like an inline compiler argument than actual as3 code. so no, you can not use variables the embed command.



来源:https://stackoverflow.com/questions/8452993/how-do-i-use-as3-to-embed-an-swf-file-and-control-is-using-play

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!