/** * Copyright (c) 2006 Peter Goodman * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ import FA.*; // I should shoot myself for using globals and singletons _global.fa_cache = { }; _global.fa_depth = 0; _global.$ = function(e, c) : FA.query { var o:Array = [], d:Boolean = false, g:Boolean = true; if(c != undefined && c.filearts) { c = c._get(); } if(e.filearts != undefined) { o = e._get(); } else { switch((typeof e).toLowerCase()) { case 'number': { e = new String(e); } case 'string': { if(e.indexOf(',') != -1) { return $(e.split(','), c); } if(_global.fa_cache[e] != undefined) { o[0] = eval(_global.fa_cache[e]); } else { if(c != undefined && c[e] != undefined) { o[0] = c[e]; } } break; } case 'movieclip': case 'textfield': case 'xml': case 'xmlsocket': case 'object': case 'array': { //if( ((e.appendChild == undefined || e.attributes == undefined) && !e instanceof XML) || e instanceof XML) //if(!e instanceof Array) //{ // still problems with stupid childNodes. if(e instanceof Array || (e instanceof Object && e.length) ) { /*var i:Number = -1; for(var r in e) { o[++i] = e[r]; }*/ o = e; } else { o[0] = e; } break; } /*case 'array': { break; }*/ default: { d = true; } } } return new FA.query(o, d); };