Return to Snippet

Revision: 28531
at July 9, 2010 04:57 by adamcoulombe


Initial Code
//Get the LoaderMax and GreenSock classes at http://www.greensock.com/

import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;

var xml:XMLLoader;
var images;
var current = 0;
var previous;

function init(){
	LoaderMax.activate([ImageLoader]);
	xml = new XMLLoader("images.xml", {name:"images", onComplete:onXmlLoaded});
	xml.load();
}

function onXmlLoaded(e){
	images = LoaderMax.getContent("images");
	nextImage();
	
}

function nextImage(){

	TweenLite.from(images[current],1,{alpha:0,
		onStart:function(){
			addChild(images[current]);
		},
		onComplete:function(){
			if(previous){
				removeChild(images[previous])
			}
			previous = current;
			if(current<images.length-1){
				current++;
			}else{
				current=0;
			}
			setTimeout(nextImage,2000);
		}
	});
}


init();

Initial URL
http://adamcoulombe.info/lab/as3/loadermaxslideshow/

Initial Description
Basic usage of GreenSock\'s LoaderMax class for AS3. A simple slideshow controlled via XML.\r\n\r\nGo to http://adamcoulombe.info/lab/as3/loadermaxslideshow/ for demo and downloads.

Initial Title
Simple Flash / AS3 Slideshow using GreenSock LoaderMax

Initial Tags
flash, xml

Initial Language
ActionScript 3