Prev | Current Page 642 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

total = total;
pictures = new Array();
container = new MovieClip();
Lib.current.addChild(container);
current = 0;
imagesLoaded = false;
loadNext();
}
private function loadNext()
{
var id = pictures.length;
var loader = new Loader();
loader.visible = false;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
loader.load(new URLRequest(PREFIX+id+EXTENSION));
container.addChild(loader);
pictures.push(loader);
}
(continued)
Part II: Server Side, JavaScript, and Flash: Oh My!
336
private function loaded(e : Event)
{
if(pictures.length < total)
loadNext();
else {
imagesLoaded = true;
dispatchEvent(new Event(Event.COMPLETE)); // no more pictures to load
}
}
public function next()
{
// prevent actions before all the images have been loaded
if(!imagesLoaded)
return;
var mc = pictures[current];
// the image that fades in must always be on top
for(i in 0...total-1)
container.swapChildrenAt(i, i+1);
// set the initial values for the transition
mc.alpha = 0.0;
mc.visible = true;
mc.


Pages:
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654