home *** CD-ROM | disk | FTP | other *** search
- package uk.kerb.utils
- {
- import flash.display.DisplayObject;
- import flash.display.Loader;
- import flash.events.Event;
- import flash.events.EventDispatcher;
- import flash.events.IOErrorEvent;
- import uk.kerb.utils.sound.ExtendedSound;
-
- public final class AssetFactory extends EventDispatcher
- {
-
- public static const EVENT_ASSET_FACTORY_READY:String = "EVENT_ASSET_FACTORY_READY";
-
-
- private var _loader:Loader = null;
-
- public function AssetFactory()
- {
- super();
- }
-
- public function initialize(param1:Class) : void
- {
- _loader = new Loader();
- _loader.contentLoaderInfo.addEventListener(Event.INIT,_onLibraryReady);
- _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,_onIOError);
- _loader.loadBytes(new param1());
- }
-
- public function createSound(param1:String) : ExtendedSound
- {
- var _loc2_:Class = Class(_loader.contentLoaderInfo.applicationDomain.getDefinition(param1));
- return new _loc2_() as ExtendedSound;
- }
-
- public function createDisplayObject(param1:String) : DisplayObject
- {
- var _loc2_:Class = Class(_loader.contentLoaderInfo.applicationDomain.getDefinition(param1));
- return new _loc2_() as DisplayObject;
- }
-
- private function _onLibraryReady(param1:Event) : void
- {
- _loader.contentLoaderInfo.removeEventListener(Event.INIT,_onLibraryReady);
- dispatchEvent(new Event(EVENT_ASSET_FACTORY_READY));
- }
-
- private function _onIOError(param1:Event) : void
- {
- }
- }
- }
-