加载大量图像以形成缩略图库
我正在尝试实现一个照片库,每当我选择某个图像文件夹时,图像就会以缩略图形式显示。
例如,如果我单击文件夹 A,它会将所有图像加载到数组列表中,该数组列表将设置为我的列表中的 dataProvider 以创建图块布局。
但我意识到,如果我有 500 张图像,每当我在滚动视图上向下滚动时,它就会有点滞后。
有什么方法可以在显示之前先加载我的所有图像吗? 或者有什么方法可以减少延迟
<s:List id="list" includeIn="initialScreen,thumbnailState" x="372" y="25" width="600"
height="750" dataProvider="{imageList}"
itemRenderer="spark.skins.spark.DefaultComplexItemRenderer"
click.thumbnailState="list_clickHandler(event)">
<s:layout>
<s:TileLayout horizontalGap="15" orientation="rows" verticalGap="15"/>
</s:layout>
</s:List>
I am trying to achieve a Photo gallery where images are showed in thumbnails whenever i select a certain folder of images.
For example, if i were to click on the folder A, it will load all the images into a arraylist which will be set as the dataProvider for in my List to create the tilelayout.
But i realized that, if i have 500 images, and whenever i scroll down on my scrollview, it kind of lags.
Is there any way where it will load all my images first, before displaying?
Or any way to make it less laggy
<s:List id="list" includeIn="initialScreen,thumbnailState" x="372" y="25" width="600"
height="750" dataProvider="{imageList}"
itemRenderer="spark.skins.spark.DefaultComplexItemRenderer"
click.thumbnailState="list_clickHandler(event)">
<s:layout>
<s:TileLayout horizontalGap="15" orientation="rows" verticalGap="15"/>
</s:layout>
</s:List>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://www.wastedpotial.com/?p=38
http://code.google.com/p/bulk-loader/
http://tutorials.flashmymind.com/2009/02/loading-multiple-图片/
使用 AS3 QueueLoader——它使我能够将资源添加到队列中,并且仍然将预加载保留为一个进程。
这是一些将图像添加到队列的代码。
我希望这对你有帮助。
http://www.wastedpotential.com/?p=38
http://code.google.com/p/bulk-loader/
http://tutorials.flashmymind.com/2009/02/loading-multiple-images/
Using AS3 QueueLoader -- it enabled me to add assets to the queue , and still kept my preloading as one process.
Here is some code that adds images to the queue.
I hope this helps you.
Greensock 有一个很棒的新加载器类,名为 LoaderMax。它类似于 BulkLoader 或 QueueLoader,但提供更多选项、更好的性能和更小的文件大小。看看该页面上的示例。它正是您正在寻找的。
Greensock has a fantastic new loader class called LoaderMax. It's similar to BulkLoader or QueueLoader, but offers a lot more options, better performance, and a smaller filesize. Take at look at their examples on that page. It does exactly what you're looking for.
我有一个网站,一个目录中约有 500 张奇怪的照片。我制作了一个简单的 HTML 页面,可以同时加载所有大约 500 个奇怪的缩略图。仅加载缩略图就需要超过 15 MB 的 HTTP 流量。
未来几年,这将超出某些浏览器和某些连接的能力。 (这很适合我。)
仔细看看您实际使用了多少数据 - 您可能会意识到您感知到的速度下降是非常合理的。
I have a website with ~500 odd photos in one directory. I made a simple HTML page that loads all ~500 odd thumbnails simultaneously. Loading the thumbnails alone takes over 15 megabytes of HTTP traffic.
That's going to be outside the abilities of some browsers and some connections for years to come. (It suits me fine.)
Take a closer look at how much data you're actually using -- you might come to realize your perceived slowdowns are very reasonable.