如何将图片文件夹添加到 Flash 应用程序?

发布于 2024-11-16 12:55:01 字数 264 浏览 8 评论 0原文

我有一个显示图片的 Flash 应用程序(部署为 Air 或 iOS 的常规应用程序)。

它必须离线工作,所以我需要将我的照片与 Flash 应用程序捆绑在一起。我编写了一个脚本,在部署 Flash 应用程序之前将所有图片从服务器下载到特定文件夹。目前,我从 FLA 中删除所有现有图片并添加新图片,但我想知道是否有一种方法可以为 Flash 定义系统文件夹,并且它将在部署过程中获取其中存在的任何内容?

所以基本上我要做的就是运行我的脚本(用新图片更新文件夹)并重新编译 FLA。

I have a flash app (deployed as Air or regular app for iOS) which displays pictures.

It has to work offline, so I need to bundle my pictures with the flash app. I wrote a script to download all pics from my server to a specific folder before deploying the flash app. Currently, I remove all existing pictures from the FLA and add the new ones, but I was wondering whether there is a way to define a system folder for flash and it will take whatever exists there during the deployment process?

So basically all I'll have to do will be to run my script (to update the folder with the new pics) and recompile the FLA.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雾里花 2024-11-23 12:55:01

嗯,我不知道闪存是否提供任何功能来直接满足您的要求。我也没有注意到 AIR,因为没有相同的标签。无论如何,这是我的 2 美分。

  • 使用文档类(或条目
    as3 文件)来嵌入您的资源。
  • 使用脚本更改类文件。

嵌入是通过以下方式完成的,

[Embed("ImageName.png")] const ImageName:Class;

因此每次您的脚本将图像添加到文件夹中时,它都可以将图像的嵌入行添加到 Document 类 AS3 文件中。然后,您可以像往常一样访问 Flash 中的资源,

var obj:DisplayObject = new ImageName();

编辑:

嵌入的每个图像都应该有一个与之关联的类。否则,嵌入后您将如何访问图像。所以无论你做什么,每张图像都需要一个类。不用担心 2000 个变量会导致内存膨胀什么的。它们将在运行时由闪存很好地管理。

此外,AS3 在运行时无法访问文件系统,因此此时可能没有解决方案。

来看看那些有类似疑问的人&得到类似的回复

http://flashpunk.net/forums/index.php?topic=2323.0

Actionscript 嵌入数组

这里有一些其他元数据标签

http://www.boostworthy.com/blog/ ?p=157

Well I don't know if flash offers any feature to ease your requirement directly. Also I didn't notice AIR, as there is no tag for the same. Anyways here is my 2 cents.

  • Use the document class (or the entry
    as3 file) to embed your resources.
  • Alter the class file with a script.

Embedding is done by

[Embed("ImageName.png")] const ImageName:Class;

So every time your script adds an image into the folder, it can add the embed lines for the image into the Document class AS3 file. You may then access the resource in flash as usual,

var obj:DisplayObject = new ImageName();

EDIT:

Every Image that is embedded should have a class associated with it. Or else, how else will you access the image after embedding. So whatever you do, every image needs a class. Dont worry about 2000 variables bloating memory or something. They will be managed just fine by flash during runtime.

Also AS3 does not have access the to the file system at runtime so there could be no solution at that point.

Here have a look at those people who had similar doubts & got similar responses

http://flashpunk.net/forums/index.php?topic=2323.0

Actionscript embed an array

And here is a little of other metadata tags

http://www.boostworthy.com/blog/?p=157

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文