AS3 to Generate Dynamic SWF?

2019-02-21 03:38发布

Is it possible, using AS3, to programmatically generate a .swf file? What my little app does is load a bunch of images, using FileReference, now I want to compile them into a stand-alone swf that the user can download (the swf will be a slideshow).

[edit]

There seems to be some mis-understanding of what I am asking. I want to have one compiled swf from which the user may select some images and press a button whereby the swf will create and compile a second swf containing said images. As this is a stand-alone app, there will be no server-side interaction.

What I am thinking is that there will be a string representing a dynamic class. When the user selects their images the appropriate embed tags are added to this string, which is then compiled and saved to the user's desktop.

So my question is, can a compiled swf generate and compile a second swf?

4条回答
Anthone
2楼-- · 2019-02-21 04:20

It should be possible to do server side, by generating the relevant code and running the as3 compiler.

查看更多
淡お忘
3楼-- · 2019-02-21 04:25

You could also use swfmill, a command-line tool to create SWF files from XML documents.

It's not well documented but for basic usages (such as creating asset libraries) you should find what you need.

查看更多
爷的心禁止访问
4楼-- · 2019-02-21 04:28

Take a look at this library, this allows you to create a .swf at runtime. https://github.com/claus/as3swf

查看更多
手持菜刀,她持情操
5楼-- · 2019-02-21 04:37

I haven't investigated the package thoroughly, but the As3Eval library seems to be doing what you're asking - realtime compilation of AS3 into executable bytecode (on the client with no server interaction). Check out the demo.

I'm not sure it would support image embedding - perhaps you could encode the image data as a base64 string in your dynamically built source code.

查看更多
登录 后发表回答