-
preloading multiple large images challenge
Hey there,
This is the best example of what I'm trying to achieve:
http://www.three60.com.au/
This site loads in all of the large images behind the scenes, so once you click through a project, the images appear immediately.
I have a rough concept of how do to this, but I am very new to as3 so I was curious as to how others would approach this?
Thanks in advance.
Ben.
-
KoolMoves Moderator
I recently made use of this tutorial for loading a list of images.
-
Hello
In your Main-constructor, call the function bellow.
PHP Code:
public function loadImages()
{
for (var i = 0; i < _nrOfImages; i++)
{
var loader:Loader = new Loader()
loader.load(new URLRequest("images/image" + i + ".jpg"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
}
private function imageLoaded(e:Event):void
{
_loadedImages.push(e.target.content);
}
Before this you have to declare _nrOfImages and _loadedImages.
These functions will load your images and store them in an array. You can then reach them with _loadedImages[i].
The order your images are stored in your array will vary. So you have to solve that part yourself.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|