在没有 HTTP 的情况下在 AIR 中加载图像和视频
我很好奇直接从文件系统加载图像和视频数据而不使用 HTTP 的正确方法是什么。
我正在编写一个 AIR 幻灯片应用程序,它工作得很好,但目前依赖于本地 MAMP 服务器通过标准的、经过验证的、真实的 FLASH 媒体加载方法向应用程序传递所有媒体。
我知道,由于 FLASH 是作为网络插件开发的,因此它可以最好地处理这种接收数据的方式,但我真的很想摆脱这个相当繁重和不必要的部分,并将该应用程序作为独立的播放器,但是,我不清楚加载媒体的“正确”方法是什么。
我已准备好文件对象,并且已经让用户选择从中提取媒体的本地目录,并且我从列表中获取了文件列表(基于其扩展名)...但是现在怎么办?
I'm curious what the correct methodology is for loading image and video data directly from the file system, without employing HTTP.
I'm writing an AIR slideshow application, and it works great but currently relies on a local MAMP server to hand the app all the media via the standard, tried and true, FLASH media loading methodologies.
I know that since FLASH was developed as a web plugin it handles this way of receiving data best, but I'd really like to extricate this rather onerous and unnecessary bit and have the app as a stand-alone player, however, I'm unclear what the "correct" way is to load the media.
I have the File objects ready and I've gotten as far as having the user select the local directory from which to pull the media and I'm getting a list of the files (based on their extensions) from the list... but now what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您首先必须将文件的内容放入
ByteArray
中(代码来自FileStream
文档)然后您可以在
Loader
中加载这些字节以显示图像(参见方法加载器。 loadBytes
)干杯
You first have to put the content of your file in a
ByteArray
(code fromFileStream
documentation)Then you may load these bytes in a
Loader
to display the image (see methodLoader.loadBytes
)Cheers
使用此代码,加载程序会触发 Event.COMPLTE 事件,您将能够从中操作位图:
PS:谢谢 Kodiak,我根据您的代码编写了我的代码。
With this code the Loader fires the Event.COMPLTE event and you will be able to manipulate the Bitmap from it:
PS: Thanks Kodiak, I made my code based on yours.