如何将 jpg 文件添加到 ipa 并使用 FileStream 类加载它们
我正在为 IOS 机器开发一个带有 actionScript-3 的瓦片引擎。有没有办法用IPA打包JPG文件,然后用Adobe Air的FileStream类读取它们。我需要异步读取文件。嵌入它们或将它们放入 SWC 中没有帮助。
我了解它在桌面上的工作原理。
var file:File = File.documentsDirectory.resolvePath("myfile.txt");
在桌面上,意味着:
[user_dir]/Documents/myfile.txt
在 IOS 上:
[app_dir]/Documents/myfile.txt
如何打包“[app_dir]/Documents/”目录中包含“myAsset.jpg”的 IPA?
我尝试打开一个“Documents”目录并在其中放入一些文件,并将其包含在 flash builder 4.5.1 的运行配置的包内容部分中。但这没有用。
谢谢。
I'm developing a tile engine with actionScript-3 for IOS machines. Is there a way to package JPG files with IPA and then read them with Adobe Air's FileStream Class. I need to read files asynchronously. Embeding them or putting them in a swc wouldn't help.
I understand how it works on desktop.
var file:File = File.documentsDirectory.resolvePath("myfile.txt");
On desktop, means:
[user_dir]/Documents/myfile.txt
On IOS:
[app_dir]/Documents/myfile.txt
How can I package the IPA that has "myAsset.jpg" in "[app_dir]/Documents/" directory?
I tried to open a "Documents" directory and put some files in it and include it in the package content section of the run configration of flash builder 4.5.1. But that didn't work.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您将图像文件与应用程序打包时,它们将位于应用程序目录中,您可以使用 File.applicationDirectory 属性访问该目录。您应该能够直接从那里加载图像。如果您想要文档目录中的图像,则必须在安装后将它们复制到那里。
When you package the image files with your application, they will be in the application directory, which you can access with the File.applicationDirectory property. You should be able to load your images directly from there. If you want the images in the documents directory, you will have to copy them there after installation.
Joes 答案的一项补充:
当您在 adt 上添加文件夹时,将添加实际文件夹而不是其内容。
因此,如果您添加文件夹资源,您可以像这样访问图像:
File.applicationDirectory.resolvePath("assets/image.jpg");
One Addition to Joes answer:
When you add a folder over adt the actual folder is added not its contents.
So if you add the Folder assets you access your images like this:
File.applicationDirectory.resolvePath("assets/image.jpg");