/** * Copyright (c) 2006 Peter Goodman * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ //-------------------------------------------- // Class for shortening code. //-------------------------------------------- dynamic class FA.Query { //-------------------------------------------- // The main object that all of these functions // deals with. //-------------------------------------------- private var _object; //-------------------------------------------- // Is the object that we are using 'dirty'? // Meaning, are we actually able to work with it // or is it a string, number, or boolean? //-------------------------------------------- private var _is_dirty:Boolean = false; //-------------------------------------------- // A list of sub objects that this class has access // to. //-------------------------------------------- private var _sub_classes:Array = [ ]; //-------------------------------------------- // Constructor, pass whatever it is (z) that we // will be fooling around with, and if actually // is something that most functions can use (d) //-------------------------------------------- public function Query (object, is_dirty) { _object = object; _is_dirty = is_dirty; _sub_classes = FA.Globals.get('fa_query_subclasses'); } //-------------------------------------------- // Deal with the calling of functions that are not // in this class but in sub classes. //-------------------------------------------- public function __resolve(method_name) : Function { var return_val:Function; for(var i = 0; i < _sub_classes.length; i++) { if(_sub_classes[i][method_name].constructor == Function) { var temp_function:Function = function() { return this._sub_classes[i][method_name].apply(this, arguments); }; //-------------------------------------------- // By putting this here, resolve will not need // to be called in the future. //-------------------------------------------- this[name] = temp_function; //-------------------------------------------- // return the temporary functor that we made. //-------------------------------------------- return_val = temp_function; break; } } //-------------------------------------------- // return the function. //-------------------------------------------- return return_val; } }