1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| package {
import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.utils.Timer;
import flash.events.Event;
import flash.events.TimerEvent;
import caurina.transitions.*;
public class Diaporama extends MovieClip {
var images;
var compt:uint=0;
var delai:Timer = new Timer(3000);
public function Diaporama(list:Array):void {
images=list;
this.addChild(new MovieClip());
this.addChild(new MovieClip());
delai.addEventListener(TimerEvent.TIMER,charger);
charger();
}
private function charger(e=0) {
delai.stop();
this.swapChildrenAt(0,1);
this.removeChildAt(1);
var l:Loader=new Loader();
l.contentLoaderInfo.addEventListener(Event.COMPLETE,appar);
l.load(new URLRequest(images[compt]));
this.addChildAt(l,1);
compt++;
if(compt>=images.lenght){
compt=0;
}
}
private function appar(e:Event){
this.getChildAt(1).alpha=0;
Tweener.addTween(this.getchild(1),{alpha:1, time:1, transition:"linear"});
delai.start();
}
}
} |
Partager