ok..well I havent tested the unloading part yet.. but this is what the code should have been (he just had a few typos and one pathing error)..but overall a GREAT dynamic code you shoudl KEEP for your 'code bank/library'
Code:var container = this.createEmptyMovieClip("container", 1); container.loadMovie("external.jpg"); var bgColor = 0xA5A5A5; var barColor = 0x333333; // create the necessary movieclips // create prealoader clip var _preLoad = _root.createEmptyMovieClip("_preLoad", 200); // position the loader center stage _preLoad._x = Math.round((Stage.width/2)-100); _preLoad._y = Math.round((Stage.height/2-10)); // create loading bar clip var bg = _preLoad.createEmptyMovieClip("bg", 1); // draw the load bar background bg.lineStyle(0, barColor, 100); bg.beginFill(bgColor, 75); bg.lineTo(200, 0); bg.lineTo(200, 20); bg.lineTo(0, 20); bg.lineTo(0, 0); bg.endFill(); // create a Text Format object var tf = new TextFormat(); tf.font = "Verdana"; tf.align = "left"; tf.size = 10; tf.color = barColor; _root.container.stop(); _preLoad.onEnterFrame = function() { var loadBar = bg.createEmptyMovieClip("loadBar", 5); // create the textfield bg.createTextField("display_txt", 3, (this.bg._width/2 - 50), 0, 0, 0); if (_root.container.getBytesLoaded()>0) { var percent = Math.round((100/_root.container.getBytesTotal())*_root.container.getBytesLoaded()); } else { var percent = 0; } bg.display_txt.autoSize = true; bg.display_txt.text = "Loading... "+percent+"%"; bg.display_txt.setTextFormat(tf); // progress bar bg.loadBar.beginFill(barColor, 100); bg.loadBar.lineTo(percent*2, 0); bg.loadBar.lineTo(percent*2, 20); bg.loadBar.lineTo(0, 20); bg.loadBar.lineTo(0, 0); bg.loadBar.endFill(); if (percent >= 100) { this._.removeMovieClip(); delete this.onEnterFrame; bg.display_txt.text = ""; } }; stop();





Reply With Quote