Flex 4/Air 中读取本地图像最简单、最高效的方法
我只是想知道如果我只有该图像的本机路径(例如 C:\myImage.jpg),您会建议我从 Air 应用程序的本地目录中读取图像文件吗?
由于我的网格项渲染器需要读取这些缩略图,因此性能对我来说非常重要。我现在用流来做,但我不确定这是否是最好的方法。任何建议都将受到高度赞赏。
I just wonder what you would suggest me to read an image file from the local directory in my Air application if I only have the native path (eg C:\myImage.jpg) of this image?
Since my grid item renderer needs to read those thumbnail images, the performance is very important for me. I do it with stream now but I m not sure if it is the best way. Any suggestion is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太清楚您的应用程序将如何工作,但这里有两个提示,我希望能以某种方式帮助您:
如果您想在 Flex/Air 应用程序中拥有图像资源 - 将它们包含在您的应用程序中。
如果您想访问本地文件(只有 Air 应用程序可以做到) - 将它们作为二进制文件读取 - 这是最快的方法,因为您将使用 Air 中提供的最低文件访问 API。
ps 考虑为您的项目渲染器预填充资源。也许某种缓存代理适合您。当然,你必须执行它。我还没有看到现成的解决方案,因为这是一个非常具体的任务,并不难实现。
It is not really clear for me how your application will work but here are two tips for you that I hope will help you somehow:
If you want to have image resources in you Flex/Air app - include them in you applications.
If you want to access local files (only Air app can do it) - read them as binary files - this is fastest way, because you will use lowest-file-access API available in Air.
p.s. Think about pre-populating resources for your item-renderer. Maybe some kind of caching proxy will work for you. Of course you will have to implement it. I didn't see ready to go solutions yet because it is very specific task which is not really hard to implement.