使用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.
  1. //Get the LoaderMax and GreenSock classes at http://www.greensock.com/
  2.  
  3. import com.greensock.*;
  4. import com.greensock.loading.*;
  5. import com.greensock.events.LoaderEvent;
  6. import com.greensock.loading.display.*;
  7.  
  8. var xml:XMLLoader;
  9. var images;
  10. var current = 0;
  11. var previous;
  12.  
  13. function init(){
  14. LoaderMax.activate([ImageLoader]);
  15. xml = new XMLLoader("images.xml", {name:"images", onComplete:onXmlLoaded});
  16. xml.load();
  17. }
  18.  
  19. function onXmlLoaded(e){
  20. images = LoaderMax.getContent("images");
  21. nextImage();
  22.  
  23. }
  24.  
  25. function nextImage(){
  26.  
  27. TweenLite.from(images[current],1,{alpha:0,
  28. onStart:function(){
  29. addChild(images[current]);
  30. },
  31. onComplete:function(){
  32. if(previous){
  33. removeChild(images[previous])
  34. }
  35. previous = current;
  36. if(current<images.length-1){
  37. current++;
  38. }else{
  39. current=0;
  40. }
  41. setTimeout(nextImage,2000);
  42. }
  43. });
  44. }
  45.  
  46.  
  47. init();

以上是关于使用GreenSock LoaderMax进行简单的Flash/AS3幻灯片放映的主要内容,如果未能解决你的问题,请参考以下文章

GreenSock动画平台学习笔记LoaderMax

GreenSock动画平台学习笔记Loadermax

javascript animation lib greensock gsap介绍

ActionScript 3 Basic LoaderMax XML加载设置

使用TweenMax的简单Tween动画

javascript GreenSock - GSAP |当使用set()或from()方法(如fromTo() - GSAP - GreenSock |)时,防止立即渲染HTML5 |