使用GreenSock LoaderMax进行简单的Flash/AS3幻灯片放映
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用GreenSock LoaderMax进行简单的Flash/AS3幻灯片放映相关的知识,希望对你有一定的参考价值。
Basic usage of GreenSock's LoaderMax class for AS3. A simple slideshow controlled via XML. Go to http://adamcoulombe.info/lab/as3/loadermaxslideshow/ for demo and downloads.
//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();
以上是关于使用GreenSock LoaderMax进行简单的Flash/AS3幻灯片放映的主要内容,如果未能解决你的问题,请参考以下文章
javascript animation lib greensock gsap介绍
ActionScript 3 Basic LoaderMax XML加载设置
javascript GreenSock - GSAP |当使用set()或from()方法(如fromTo() - GSAP - GreenSock |)时,防止立即渲染HTML5 |