class IMG_Loader extends mx.core.UIComponent { var parent_mc, _x, _y, loader, __get__autoLoad, image_str, image_width, image_height, easing_type, easing_speed, invalidate, __get____width, __get____height, _loaded, _total, _percent, auto_load, __get__contentPath, scale_content, __get__scaleContent, __get__easingType, __get__easingSpeed, loader_visible, __get__preloader, loader_color, __get__preloaderColor, transition_bool, __get__transition, boundingBox_mc, __set__autoLoad, __set__scaleContent, __set__easingType, __set__easingSpeed, __set__preloader, __set__preloaderColor, __set__transition, addEventListener, dispatchEvent, image_mc, onEnterFrame, __set____height, __set____width, __get__bytesLoaded, __get__bytesTotal, __set__contentPath, __get__percentLoaded; function IMG_Loader() { super(); parent_mc = this; parent_mc.$obj = this; parent_mc._x = Math.ceil(_x); parent_mc._y = Math.ceil(_y); mx.events.EventDispatcher.initialize(this); loader = new MovieClipLoader(); loader.addListener(this); if (this.__get__autoLoad()) { this.load(); } // end if } // End of the function function get_parent_mc() { return (parent_mc); } // End of the function function get_image_str() { return (image_str); } // End of the function function get_image_width() { return (image_width); } // End of the function function get_image_height() { return (image_height); } // End of the function function get_easing_type() { if (easing_type == "none") { return (IMG_Loader.easeNone); } else if (easing_type == "in") { return (IMG_Loader.easeIn); } else if (easing_type == "out") { return (IMG_Loader.easeOut); } // end else if } // End of the function function get_easing_speed() { switch (easing_speed) { case 1: { return (3000); break; } case 2: { return (2000); break; } case 3: { return (1000); break; } case 4: { return (400); break; } case 5: { return (350); break; } case 6: { return (250); break; } case 7: { return (200); break; } case 8: { return (150); break; } case 9: { return (50); break; } case 10: { return (10); break; } } // End of switch } // End of the function function set __width(w) { image_width = Math.ceil(w); this.invalidate(); //return (this.__width()); null; } // End of the function function get __width() { return (image_width); } // End of the function function set __height(h) { image_height = Math.ceil(h); this.invalidate(); //return (this.__height()); null; } // End of the function function get __height() { return (image_height); } // End of the function function get bytesLoaded() { return (_loaded); } // End of the function function get bytesTotal() { return (_total); } // End of the function function get percentLoaded() { return (_percent); } // End of the function function set autoLoad(bool) { auto_load = bool; this.invalidate(); //return (this.autoLoad()); null; } // End of the function function get autoLoad() { return (auto_load); } // End of the function function set contentPath(str) { image_str = str; this.invalidate(); //return (this.contentPath()); null; } // End of the function function get contentPath() { return (image_str); } // End of the function function set scaleContent(bool) { scale_content = bool; this.invalidate(); //return (this.scaleContent()); null; } // End of the function function get scaleContent() { return (scale_content); } // End of the function function set easingType(str) { easing_type = str; this.invalidate(); //return (this.easingType()); null; } // End of the function function get easingType() { return (easing_type); } // End of the function function set easingSpeed(num) { easing_speed = num; this.invalidate(); //return (this.easingSpeed()); null; } // End of the function function get easingSpeed() { return (easing_speed); } // End of the function function set preloader(str) { loader_visible = str; this.invalidate(); //return (this.preloader()); null; } // End of the function function get preloader() { return (loader_visible); } // End of the function function set preloaderColor(num) { loader_color = num; this.invalidate(); //return (this.preloaderColor()); null; } // End of the function function get preloaderColor() { return (loader_color); } // End of the function function set transition(str) { transition_bool = str; this.invalidate(); //return (this.transition()); null; } // End of the function function get transition() { return (transition_bool); } // End of the function function init() { super.init(); boundingBox_mc._visible = false; boundingBox_mc._width = 0; boundingBox_mc._height = 0; } // End of the function function draw() { if (this.__get__autoLoad() == undefined) { this.__set__autoLoad(true); } // end if if (this.__get__scaleContent() == undefined) { this.__set__scaleContent(false); } // end if if (this.__get__easingType() == undefined) { this.__set__easingType("out"); } // end if if (this.__get__easingSpeed() == undefined) { this.__set__easingSpeed(6); } // end if if (this.__get__preloader() == undefined) { this.__set__preloader("on"); } // end if if (this.__get__preloaderColor() == undefined) { this.__set__preloaderColor(10066329); } // end if if (this.__get__transition() == undefined) { this.__set__transition("on"); } // end if this.load(); } // End of the function function dsp_img() { this.get_parent_mc().createEmptyMovieClip("image_mc", 3); this.get_parent_mc().image_mc.createEmptyMovieClip("c", 0); this.get_parent_mc().createEmptyMovieClip("image_msk", 4); with (this.get_parent_mc().image_msk) { beginFill(0); moveTo(0, 0); lineTo(10, 0); lineTo(10, 10); lineTo(0, 10); lineTo(0, 0); } // End of with this.get_parent_mc().image_mc.setMask(this.get_parent_mc().image_msk); } // End of the function function dsp_preloader() { this.get_parent_mc().createEmptyMovieClip("loader_brd", 5); this.get_parent_mc().loader_brd._x = this.image_width / 2 - 40; this.get_parent_mc().loader_brd._y = this.image_height / 2 - 5; with (this.get_parent_mc().loader_brd) { lineStyle(0, 0, 100); moveTo(0, 0); lineTo(80, 0); lineTo(80, 9.500000E+000); lineTo(0, 9.500000E+000); lineTo(0, 0); } // End of with var color = new Color(this.get_parent_mc().loader_brd); color.setRGB(this.loader_color); this.get_parent_mc().createEmptyMovieClip("loader_mc", 6); this.get_parent_mc().loader_mc._x = this.image_width / 2 - 38; this.get_parent_mc().loader_mc._y = this.image_height / 2 - 3; with (this.get_parent_mc().loader_mc) { beginFill(0, 100); moveTo(0, 0); lineTo(77, 0); lineTo(77, 6); lineTo(0, 6); lineTo(0, 0); endFill(); } // End of with this.get_parent_mc().loader_mc._xscale = 0; var color = new Color(this.get_parent_mc().loader_mc); color.setRGB(this.loader_color); } // End of the function function load() { this.dsp_img(); var _loc2 = new Object(); _loc2.path = this.get_parent_mc().image_mc; if (loader_visible == "on") { this.dsp_preloader(); } // end if loader.loadClip(this.get_image_str(), this.get_parent_mc().image_mc.c); } // End of the function function addListener(obj) { this.addEventListener("progress", obj); this.addEventListener("complete", obj); this.addEventListener("error", obj); } // End of the function function onLoadProgress(target_mc, bytesLoaded, bytesTotal) { this.dispatchEvent({type: "progress", target_mc: this, bytesLoaded: bytesLoaded, bytesTotal: bytesTotal}); _loaded = bytesLoaded; _total = bytesTotal; _percent = Math.round(bytesLoaded / bytesTotal * 100); this.get_parent_mc().loader_mc._xscale = _percent; } // End of the function function onLoadInit(target_mc) { this.dispatchEvent({type: "complete", target_mc: this}); this.get_parent_mc().loader_brd.removeMovieClip(); this.get_parent_mc().loader_mc.removeMovieClip(); var _loc3; var _loc2; if (scale_content) { _loc3 = image_width; _loc2 = image_height; } else { _loc3 = target_mc._width; _loc2 = target_mc._height; } // end else if this.get_parent_mc().image_mc._width = _loc3; this.get_parent_mc().image_mc._height = _loc2; this.get_parent_mc().image_msk._width = _loc3; this.get_parent_mc().image_msk._height = _loc2; if (transition_bool == "on") { this.prep_fx(); this.dsp_fx(); } // end if } // End of the function function onLoadError(target_mc, errorCode) { this.dispatchEvent({type: "error", target_mc: this, errorCode: errorCode}); } // End of the function function prep_fx() { this.get_parent_mc().image_mc._alpha = 0; } // End of the function function dsp_fx() { var current_num = 0; var alpha = 0; this.get_parent_mc().onEnterFrame = function () { var _loc2 = 100 - alpha; alpha = this.get_easing_type()(current_num, alpha, _loc2, this.get_easing_speed(), 1); image_mc._alpha = alpha; if (alpha == 100) { delete this.onEnterFrame; } // end if ++current_num; }; } // End of the function static function easeIn(t, b, c, d) { t = t / d; return (-c * (Math.sqrt(1 - t / d * t) - 1) + b); } // End of the function static function easeOut(t, b, c, d) { t = t / d - 1; return (c * ((t / d - 1) * t * t + 1) + b); } // End of the function static function easeNone(t, b, c, d) { return (c * t / d + b); } // End of the function var className = "IMG_Loader"; static var symbolOwner = IMG_Loader; static var symbolName = "IMG_Loader"; } // End of Class