/* Quickly load movie clips from the layouts directory onto the stage (_root) Layouts will be loaded at _x = 0 _y = 0 and should be the same dimension as main.fla but does not have to be Examples found at http://remixtechnology.com/view/layout-and-model public properties - layoutName_str :String - name of this layout object - loadedLayout_mc :MovieClip - the movieclip that this object loads - mcListener :Object - listener object that listens for MovieClipLoader events public methods - loadLayout() :Void - loads this layout - unloadLayout() :Void - unloads this layout - constructor layout([Filename of movieclip to load, without extension]:String, [load layout now?]:Boolean) ex: (in main.as) class main{ private var myLayout:layout; function main(){ myLayout = new layout("myLayout", true); } } to reference this layout use myLayout.loadedLayout_mc to add actions to the Listener Object attached to this layout, use myLayout = new layout("myLayout"); myLayout.mcListener.onLoadInit = function(layout_mc:MovieClip){ //do stuff to myLayout.loadedLayout_mc after it's loaded layout_mc._width = 300; layout_mc._height = 250; } myLayout.loadLayout(); to destroy the layout, use unloadLayout() myLayout.unloadLayout(); unloadLayout() will also destroy all models loaded into it. */ class layout extends MovieClipLoader{ private var _layoutName:String; private var _loadedLayout:MovieClip; private var _mclistener:Object; public function get layoutName_str():String{ return this._layoutName; } public function get loadedLayout_mc():MovieClip{ return this._loadedLayout; } public function get mcListener():Object{ return this._mclistener; } public function loadLayout():Void{ this._loadedLayout = _root.createEmptyMovieClip(this._layoutName + _root.getNextHighestDepth(), _root.getNextHighestDepth()); this._loadedLayout._x = 0; this._loadedLayout._y = 0; this.loadClip(cfg.layoutDir + this._layoutName + cfg.layoutExt, this._loadedLayout); } public function unloadLayout():Void { unloadMovie(_root[this._layoutName]); _root[this._layoutName].removeMovieClip(); } public function layout(layoutName:String, loadLayoutNow:Boolean){ super(); //cause actionscript is super! this._layoutName = layoutName; this._mclistener = new Object(); this.addListener(this._mclistener); if(loadLayoutNow) this.loadLayout(); } }