Prev | Current Page 638 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

jpg???;
private var total : Int;
private var pictures : Array < MovieClip > ;
private var current : Int;
private var container : MovieClip;
private var imagesLoaded : Bool;
public function new(total : Int)
{
this.total = total;
pictures = new Array();
container = Lib.current.createEmptyMovieClip(???container???, 0);
current = 0;
imagesLoaded = false;
loadNext();
}
private function loadNext()
{
if(pictures.length == total)
{
imagesLoaded = true; // no more pictures to load
onLoad(); // trigger the onLoad event
return;
}
Chapter 12: Building Interactive Content with Flash
333
var id = pictures.length;
var mc = container.createEmptyMovieClip(???image??? + id, id);
mc._visible = false;
pictures.push(mc);
load(mc, PREFIX+id+EXTENSION);
}
// exposed event
public function onLoad() { }
private function load(target : MovieClip, path : String)
{
var me = this;
container.onEnterFrame = function()
{
if(target.getBytesTotal() < = 0 ||
target.getBytesLoaded() < target.getBytesTotal())
return;
target.


Pages:
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650