/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package kc.core { public class KCClassFactory extends Object implements IPurger { // @protected protected var _value:Class; protected var _properties:Object; // @constructor public function KCClassFactory( value:Class ) { super(); _value = value; } // @getters public function get properties():Object { return this._properties; } // @methods public function newInstance( properties:Object = null ):Class { var instance:Class = new _value(); if( properties != null ){ _properties = properties; for( var key:String in _properties ){ instance[key] = _properties[key]; } } return instance; } // @purge public function purge(...rest):void { _properties = null; _value = null; } } }
URL: http://www.kirikacode.com