/** * com.sekati.load.Loader * @version 1.0.0 * @author jason m horwitz | sekati.com | tendercreative.com * Copyright (C) 2007 jason m horwitz, Sekat LLC. All Rights Reserved. * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php */ import com.sekati.events.AbstractEventBroadcaster; import com.sekati.load.LoaderEvent; /** * CoreLoader */ class com.sekati.load.Loader extends AbstractEventBroadcaster { private var _url:String; private var _rawURL:String; private var _reloads:Number; private var _reloadCount:Number; private var _isReady:Boolean; private var _d:Function; private var _child:Object; /** * Constructor */ public function Loader() { super( ); _child = Object( this ); _isReady = false; _reloadCount = 0; } public function reload():Void { _child.unload( ); _child.load( ); } public function getPercent():Number { var percent:Number = _child._container.getBytesLoaded( ) / _child._container.getBytesTotal( ) * 100; return ( !(percent >= 0) || isNaN( percent ) ) ? 0 : Math.round( percent ); } public function getRetryCount():Number { return _reloadCount; } public function isReady():Boolean { return _isReady; } public function getContainerRef():Object { return _child._container; } private function onProgress():Void { broadcastEvent( LoaderEvent.PROGRESS, _child ); } /** * The raw URL passed, no cacheBuster */ public function getRawURL():String { return _rawURL; } /** * The actual URL getting used, with cacheBuster */ public function getURL():String { return _url; } }