PRELOAD THIS

Out of context: Reply #2

  • Started
  • Last post
  • 6 Responses
  • Timson0

    i hope this code will survive in here. it's a 100% AS 2.0 based preloader. works like a charm and easy to customize. here we go:
    // preloader
    var barWidth:Number = 200;
    var barHeight:Number = 6;

    this.createEmptyMovieClip("pBar... 9999);
    var bar:MovieClip = pBar_mc.createEmptyMovieClip("ba... 10);
    bar.beginFill(0x9C0059, 100);
    bar.moveTo(0, 0);
    bar.lineTo(barWidth, 0);
    bar.lineTo(barWidth, barHeight);
    bar.lineTo(0, barHeight);
    bar.lineTo(0, 0);
    bar.endFill();
    bar._xscale = 0;

    var stroke:MovieClip = pBar_mc.createEmptyMovieClip("st... 20);
    stroke.lineStyle(0, 0x9C0059);
    stroke.moveTo(0, 0);
    stroke.lineTo(barWidth, 0);
    stroke.lineTo(barWidth, barHeight);
    stroke.lineTo(0, barHeight);
    stroke.lineTo(0, 0);
    //
    var text_fmt:TextFormat = new TextFormat();
    text_fmt.font = "Savoye";
    text_fmt.size = 28;
    text_fmt.color = 0x9C0059;
    //
    //
    pBar_mc.createTextField("label_t... 30, 0, barHeight+5, 150, 30);
    pBar_mc.label_txt.autoSize = true;
    pBar_mc.label_txt.selectable = false;
    pBar_mc.label_txt.embedFonts = true;
    pBar_mc.label_txt.selectable = false;
    pBar_mc.label_txt.setNewTextForm...
    pBar_mc.label_txt.multiline = false;
    pBar_mc.label_txt.wordWrap = false;

    pBar_mc._x = (Stage.width - pBar_mc._width) / 2;
    pBar_mc._y = (Stage.height - pBar_mc._height) / 2;

    var my_xml:XML = new XML();
    my_xml.ignoreWhite = true;
    my_xml.onLoad = function(success:Boolean) {
    pBar_mc.onEnterFrame = undefined;
    if (success) {
    trace("XML loaded successfully");
    } else {
    trace("Unable to load XML");
    }
    };
    my_xml.load("http://www.helpexam...

    pBar_mc.onEnterFrame = function() {
    var pctLoaded:Number = Math.floor(_root.getBytesLoaded... / _root.getBytesTotal() * 100);
    if (!isNaN(pctLoaded)) {
    pBar_mc.bar_mc._xscale = pctLoaded;
    pBar_mc.label_txt.text = "Loading intro " + pctLoaded + "%";
    if (pctLoaded >= 100) {
    pBar_mc.onEnterFrame = undefined;
    _root.gotoAndPlay("begin");
    pBar_mc._visible = false;
    }
    }
    };

View thread