チェンジセット 186

差分発生行の前後
無視リスト:
コミット日時:
2008/01/02 21:30:30 (1 年前)
コミッタ:
nitoyon
ログメッセージ:

--

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/aQuery/src/com/nitoyon/aquery/Dom.as

    r183 r186  
    77        static public function firstChild( node:DisplayObject):DisplayObject { 
    88                if ( node is DisplayObjectContainer ) { 
    9                         return DisplayObjectContainer( node ).getChildAt(0); 
     9                        var c:DisplayObjectContainer = DisplayObjectContainer(node); 
     10                        return c.numChildren ? c.getChildAt(0) : null; 
    1011                } 
    1112 
    1213                return null; 
     14        } 
     15 
     16        static public function previousSibling( node:DisplayObject ):DisplayObject { 
     17                var parent:DisplayObjectContainer = node.parent; 
     18                var index:int = parent.getChildIndex(node); 
     19                return index == 0 ? null : parent.getChildAt(index - 1); 
    1320        } 
    1421 
     
    2734        } 
    2835 
    29         static public function getElementsByTagName( tagName:String, parent:DisplayObjectContainer = null, arr:Array = null ):Array { 
     36        static public function getElementsByTagName( tagName:String, parent:DisplayObject = null, arr:Array = null ):Array { 
    3037                parent = parent || aQuery.stage; 
    3138                arr = arr || []; 
    3239 
    33                 if ( parent ) { 
    34                         for ( var i:int = 0, al:int = parent.numChildren; i < al; i++) { 
    35                                 var n:DisplayObject = parent.getChildAt( i ); 
     40                if ( parent is DisplayObjectContainer ) { 
     41                        var p:DisplayObjectContainer = DisplayObjectContainer(parent); 
     42                        for ( var i:int = 0, al:int = p.numChildren; i < al; i++) { 
     43                                var n:DisplayObject = p.getChildAt( i ); 
    3644 
    3745                                if ( nodeNameCmp( n, tagName ) ) 
     
    4452                return arr; 
    4553        } 
     54 
     55        static public function getProperty( node:DisplayObject, prop:String ):Object { 
     56                return /firstChild|nextSibling|previousSibling/.test(prop) ? Dom[prop]( node ) : 
     57                        node.hasOwnProperty(prop) ? node[prop] : null; 
     58        } 
    4659} 
    4760} 
  • as3/aQuery/src/com/nitoyon/aquery/aQuery.as

    r185 r186  
    1313import flash.display.DisplayObjectContainer; 
    1414import flash.display.Stage; 
     15import com.nitoyon.aquery.aQueryFx; 
    1516 
    1617public class aQuery extends Proxy { 
     18 
     19        //-------------------------------------------------------------------------- 
     20        // 
     21        // core 
     22        // 
     23        //-------------------------------------------------------------------------- 
     24 
    1725        private static var quickExpr:RegExp = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; 
    1826 
     
    3341        } 
    3442 
    35         static internal function create(... args):aQuery { 
     43        static public function create(... args):aQuery { 
    3644                var a:Object = args[0] || _stage; 
    3745                var c:Object = args[1]; 
     
    5664                        throw new Error(); 
    5765                // HANDLE: $(XML) 
    58                 } else if( a is XML ) { 
     66                } else if( a is XML || a is XMLList ) { 
    5967                        a = aQuery.clean( [ a ]); 
    6068                // HANDLE: $(Class) 
     
    8795        } 
    8896 
     97        flash_proxy override function callProperty(name:*, ...rest):* { 
     98                return null; 
     99        } 
     100 
     101        public function toString():String { 
     102                return "[aQuery " + _array.toString() + "]"; 
     103        } 
     104 
    89105        public const aquery:String = "1.2"; 
    90106 
     
    102118                return num == -1 ?  
    103119 
    104                         // Return a 'clean' array 
    105                         aQuery.makeArray( this ) : 
     120                        getArray() : 
    106121 
    107122                        // Return just the object 
    108123                        this[num]; 
     124        } 
     125 
     126        public function getArray():Array { 
     127                // Return a 'clean' array 
     128                return aQuery.makeArray( this ); 
    109129        } 
    110130 
     
    126146 
    127147        public function index( obj:Object ):int { 
    128                 var pos:int = -1; 
    129                 each(function(i:int, val:Object):void{ 
    130                         if ( this == obj ) pos = i; 
    131                 }); 
    132                 return pos; 
     148                return _array.indexOf( obj ); 
    133149        } 
    134150 
     
    178194        } 
    179195 
    180 /*     wrapAll: function(html)
     196       public function wrapAll(html:String):aQuery
    181197                if ( this[0] ) 
    182198                        // The elements to wrap the target around 
    183                         aQuery(html, this[0].ownerDocument
     199                        aQuery.create(html, this[0].stage
    184200                                .clone() 
    185201                                .insertBefore(this[0]) 
    186                                 .map(function()
    187                                         var elem = this; 
    188                                         while ( elem.firstChild
    189                                                 elem = elem.firstChild
     202                                .map(function(...args):DisplayObject
     203                                        var elem:DisplayObject = this; 
     204                                        while ( Dom.firstChild(elem)
     205                                                elem = Dom.firstChild(elem)
    190206                                        return elem; 
    191207                                }) 
     
    193209 
    194210                return this; 
    195         }, 
    196  
    197         wrapInner: function(html)
    198                 return this.each(function()
    199                         aQuery(this).contents().wrapAll(html); 
    200                 }); 
    201         }, 
    202  
    203         wrap: function(html)
    204                 return this.each(function()
    205                         aQuery(this).wrapAll(html); 
    206                 }); 
    207         }, 
    208 */ 
     211        } 
     212 
     213        public function wrapInner(html:String):aQuery
     214                return each(function(...args):void
     215                        aQuery.create(this).contents().wrapAll(html); 
     216                }); 
     217        } 
     218 
     219        public function wrap(html:String):aQuery
     220                return each(function(...args):void
     221                        aQuery.create(this).wrapAll(html); 
     222                }); 
     223        } 
     224 
    209225        static private const props:Object = { 
    210226                "for": "htmlFor", 
     
    223239        }; 
    224240 
     241        public function parent( filter:String = null ):aQuery { 
     242                return mapAndPush(filter, function(a:DisplayObject, ...args):DisplayObject { 
     243                        return a.parent; 
     244                }); 
     245        } 
     246 
     247        public function parents( filter:String = null ):aQuery { 
     248                return mapAndPush(filter, function(a:DisplayObject, ...args):Array { 
     249                        return aQuery.dir(a, 'parent'); 
     250                }); 
     251        } 
     252 
     253        public function next( filter:String = null ):aQuery { 
     254                return mapAndPush(filter, function(a:DisplayObject, ...args):DisplayObject { 
     255                        return aQuery.nth(a, 2, 'nextSibling'); 
     256                }); 
     257        } 
     258 
     259        public function prev( filter:String = null ):aQuery { 
     260                return mapAndPush(filter, function(a:DisplayObject, ...args):DisplayObject { 
     261                        return aQuery.nth(a, 2, 'previousSibling'); 
     262                }); 
     263        } 
     264 
     265        public function nextAll( filter:String = null ):aQuery { 
     266                return mapAndPush(filter, function(a:DisplayObject, ...args):Array { 
     267                        return aQuery.dir(a, 'nextSibling'); 
     268                }); 
     269        } 
     270 
     271        public function prevAll( filter:String = null ):aQuery { 
     272                return mapAndPush(filter, function(a:DisplayObject, ...args):Array { 
     273                        return aQuery.dir(a, 'previousSibling'); 
     274                }); 
     275        } 
     276 
     277        public function siblings( filter:String = null ):aQuery { 
     278                return mapAndPush(filter, function(a:DisplayObject, ...args):Array { 
     279                        return aQuery.sibling(a.parent.getChildAt(0), a); 
     280                }); 
     281        } 
     282 
     283        public function children( filter:String = null ):aQuery { 
     284                return mapAndPush(filter, function(a:DisplayObject, ...args):Array { 
     285                        return aQuery.sibling(Dom.firstChild(a)); 
     286                }); 
     287        } 
     288 
     289        public function contents( filter:String = null ):aQuery { 
     290                return mapAndPush(filter, function(a:DisplayObject, ...args):DisplayObject { 
     291                        return a.root; 
     292                }); 
     293        } 
     294 
     295        private function mapAndPush( a:String, fn:Function ):aQuery { 
     296                var ret:Array = aQuery.map( this, fn ); 
     297                if ( a ) 
     298                        ret = aQuery.multiFilter(a, ret.getArray()); 
     299                return pushStack(aQuery.unique(ret)); 
     300        } 
     301 
    225302        public function append(... args):aQuery { 
    226303                return domManip(args, true, 1, function(a:DisplayObject):void{ 
     
    257334        } 
    258335 
    259 /*     clone: function(events)
     336       public function clone(events:Boolean = false):aQuery
    260337                // Do the clone 
    261                 var ret = this.map(function()
    262                         return this.outerHTML ? aQuery(this.outerHTML)[0] : this.cloneNode(true)
     338                var ret:aQuery = map(function(...args):DisplayObject
     339                        return aQuery.cloneObject(this) as DisplayObject
    263340                }); 
    264341                 
    265342                if (events === true) { 
    266                         var clone = ret.find("*").andSelf(); 
    267  
    268                         this.find("*").andSelf().each(function(i)
    269                                 var events = aQuery.data(this, "events"); 
    270                                 for ( var type in events ) 
    271                                         for ( var handler in events[type] ) 
    272                                                 aQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data); 
     343                        var clone:aQuery = ret.find("*").andSelf(); 
     344 
     345                        find("*").andSelf().each(function(i:int, ...args):void
     346                                var events:Object = aQuery.data(this, "events"); 
     347                                for ( var type:String in events ) 
     348                                        for ( var handler:Object in events[type] ) 
     349                                                aQueryEvent.add(clone[i], type, events[type][handler], events[type][handler].data); 
    273350                        }); 
    274351                } 
     
    276353                // Return the cloned set 
    277354                return ret; 
    278         }, 
    279 */ 
     355        } 
     356 
    280357        public function filter(t:Object):aQuery { 
    281358                return pushStack( 
     
    386463        } 
    387464 
    388 /*     replaceWith: function( val )
    389                 return this.after( val ).remove(); 
    390         }, 
    391 */ 
     465       public function replaceWith( val:Object ):aQuery
     466                return after( val ).remove(); 
     467        } 
     468 
    392469        public function slice(...args):aQuery { 
    393470                return pushStack( _array.slice.apply( this, args ) ); 
     
    404481        } 
    405482 
    406         public function domManip(args:Array, table:Boolean, dir:int, fn:Function):aQuery 
    407         { 
     483        public function domManip(args:Array, table:Boolean, dir:int, fn:Function):aQuery { 
     484                // this -> Sprite 
     485                // args -> aQuery ( "TextField" ) 
    408486                var clone:Boolean = length > 1, a:Array;  
    409487 
     
    418496 
    419497                        aQuery.each( a, function():void{ 
    420                                 fn.apply( obj, [ clone ? cloneObject(this) : this ] ); 
     498                                fn.apply( obj, [ clone ? aQuery.cloneObject(this) : this ] ); 
    421499                        }); 
    422500                }) as aQuery; 
    423501        } 
    424502 
    425         private function cloneObject(source:Object):Object { 
     503        static private function cloneObject(source:Object):Object { 
    426504                var cls:Class = getDefinitionByName(getQualifiedClassName(source)) as Class; 
    427505                if(cls) { 
     
    436514 
    437515        public function extend( ...args ):Object { 
    438                 // extend jQuery itself if only one argument is passed 
    439                 if ( args.length == 1 ) { 
    440                         return aQuery.extend( this, args[0] ); 
    441                 } 
    442  
    443516                return aQuery.extend.apply( null, args ); 
    444517        } 
     
    480553        private static var expando:String = "aQuery" + (new Date()).getTime(); 
    481554 
    482 /*      noConflict: function(deep) { 
    483                 window.$ = _$; 
    484                 if ( deep ) 
    485                         window.aQuery = _aQuery; 
    486                 return aQuery; 
    487         }, 
    488 */ 
    489  
    490555        static public function isFunction(fn:Object):Boolean 
    491556        { 
     
    499564        } 
    500565 
    501 /*      // Evalulates a script in a global context 
    502         // Evaluates Async. in Safari 2 :-( 
    503         globalEval: function( data ) { 
    504                 data = aQuery.trim( data ); 
    505                 if ( data ) { 
    506                         if ( window.execScript ) 
    507                                 window.execScript( data ); 
    508                         else if ( aQuery.browser.safari ) 
    509                                 // safari doesn't provide a synchronous global eval 
    510                                 window.setTimeout( data, 0 ); 
    511                         else 
    512                                 eval.call( window, data ); 
    513                 } 
    514         }, 
    515  
    516         nodeName: function( elem, name ) { 
    517                 return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); 
    518         }, 
    519 */ 
     566        static public function nodeName( elem:DisplayObject, name:String ):Boolean { 
     567                return Dom.nodeNameCmp( elem, name ); 
     568        } 
     569 
    520570        static private var cache:Dictionary = new Dictionary(); 
    521571 
     
    759809                                arg = arg.toString(); 
    760810                         
    761                         // Convert html string into XML 
     811                        // Convert html string into XMLList 
    762812                        if ( arg is String ) { 
    763813                                try { 
    764                                         arg  = XML(arg.toString()); 
     814                                        arg  = XMLList(arg.toString()); 
    765815                                } catch (e:*) { 
    766816                                        throw new Error("XML Parse error!!!"); 
     
    769819 
    770820                        // Convert XML into DisplayObjects 
    771                         if ( arg is XML ) { 
     821                        if ( arg is XML || arg is XMLList ) { 
    772822                                var fn:Function = function(xml:XML):DisplayObject { 
    773823                                        try { 
     
    799849                                }; 
    800850 
    801                                 arg = fn(arg); 
    802                                 if ( arg ) { 
    803                                         arg = [ arg ]; 
     851                                var list:XMLList = arg is XML ? XMLList(arg) : arg as XMLList; 
     852                                arg = []; 
     853                                for each(var x:XML in list) { 
     854                                        var d:DisplayObject = fn(x); 
     855                                        if ( d ) { 
     856                                                arg.push( d ); 
     857                                        } 
    804858                                } 
    805859                        } 
     
    809863                                        r.push( arg ); 
    810864                                else 
    811                                         r = aQuery.merge( r, arg as Array); 
     865                                        r = aQuery.merge( r, aQuery.makeArray( arg ) ); 
    812866                }); 
    813867 
     
    9601014});*/ 
    9611015 
     1016        //-------------------------------------------------------------------------- 
     1017        // 
     1018        // selector 
     1019        // 
     1020        //-------------------------------------------------------------------------- 
     1021 
    9621022        static private const chars:String = "(?:[\\w*_-]|\\\\.)"; 
    9631023        static private const quickChild:RegExp = new RegExp("^>\\s*(" + chars + "+)"); 
     
    9661026 
    9671027        static private const expr:Object = { 
    968 //             "": function(a:DisplayObject,i:int){return m[2]=='*'||aQuery.nodeName(a,m[2])}, 
     1028               "": function(a:DisplayObject,i:int, m:Array, r:Array):Boolean{return m[2]=='*'||Dom.nodeNameCmp(a,m[2])}, 
    9691029//              "#": function(a:DisplayObject,i:int){return a.getAttribute('id')==m[2]}, 
    9701030                ":": { 
     
    9891049 
    9901050                        // Text Check 
    991 //                     contains: function(a:DisplayObject,i:int){return (a.textContent||a.innerText||'').indexOf(m[3])>=0}, 
     1051                       contains: function(a:DisplayObject,i:int, m:Array, r:Array):Boolean{return a.hasOwnProperty("text") && a["text"].toString().indexOf(m[3])>=0}, 
    9921052 
    9931053                        // Visibility 
    9941054                        visible: function(a:DisplayObject,i:int, m:Array, r:Array):Boolean{return a.visible}, 
    995                         hidden:  function(a:DisplayObject,i:int, m:Array, r:Array):Boolean{return !a.visible}//
     1055                        hidden:  function(a:DisplayObject,i:int, m:Array, r:Array):Boolean{return !a.visible}
    9961056 
    9971057/*                      // Form attributes 
     
    10001060                        checked: function(a:DisplayObject,i:int){return a.checked}, 
    10011061                        selected: function(a:DisplayObject,i:int){return a.selected||aQuery.attr(a,'selected')}, 
    1002  
     1062*/ 
    10031063                        // Form elements 
    1004                         text: function(a:DisplayObject,i:int){return 'text'==a.type}, 
    1005                       radio: function(a:DisplayObject,i:int){return 'radio'==a.type}, 
     1064                        text: function(a:DisplayObject,i:int, m:Array, r:Array):Boolean{return Dom.nodeNameCmp(a, "TextField")}, 
     1065/*                    radio: function(a:DisplayObject,i:int){return 'radio'==a.type}, 
    10061066                        checkbox: function(a:DisplayObject,i:int){return 'checkbox'==a.type}, 
    10071067                        file: function(a:DisplayObject,i:int){return 'file'==a.type}, 
     
    10121072                        button: '"button"==a.type||aQuery.nodeName(a,"button")', 
    10131073                        input: function(a:DisplayObject,i:int){return (/input|select|textarea|button/i).test(a.nodeName)}, 
    1014  
     1074*/ 
    10151075                        // :has() 
    1016                         has: function(a:DisplayObject,i:int){return aQuery.find(m[3],a).length}, 
     1076                        has: function(a:DisplayObject,i:int, m:Array, r:Array):Boolean{return aQuery.find(m[3],a).length != 0}, 
    10171077 
    10181078                        // :header 
    1019                         header: function(a:DisplayObject,i:int){return (/h\\d/i).test(a.nodeName)}, 
     1079                        header: function(...args):Boolean{return false} 
    10201080 
    10211081                        // :animated 
    1022                         animated: function(a:DisplayObject,i:int){return aQuery.grep(aQuery.timers,function(fn){return a==fn.elem;}).length}*/ 
     1082                        //animated: function(a:DisplayObject,...args):Boolean{return aQuery.grep(aQuery.timers,function(fn,...args){return a==fn.elem;}).length}*/ 
    10231083                } 
    10241084        }; 
     
    10491109        } 
    10501110 
    1051         static private function find( t:String, context:DisplayObject = null ):Array { 
     1111        static public function find( t:String, context:DisplayObject = null ):Array { 
    10521112                // Set the correct context (if none is provided) 
    10531113                context = context || _stage; 
     
    12201280        } 
    12211281 
    1222         static private function classFilter(r:Array,m:String,not:Boolean = false):Array { 
     1282        static public function classFilter(r:Array,m:String,not:Boolean = false):Array { 
    12231283                m = " " + m + " "; 
    12241284                var tmp:Array = []; 
     
    12341294        } 
    12351295 
    1236         static private function filter(t:String,r:Array,not:Boolean = false):Object { 
     1296        static public function filter(t:String,r:Array,not:Boolean = false):Object { 
    12371297                var last:Object; 
    12381298 
     
    13471407        } 
    13481408 
    1349 /*      dir: function( elem, dir ){ 
    1350                 var matched = []; 
    1351                 var cur = elem[dir]; 
    1352                 while ( cur && cur != document ) { 
    1353                         if ( cur.nodeType == 1 ) 
    1354                                 matched.push( cur ); 
    1355                         cur = cur[dir]; 
     1409        static public function dir( elem:DisplayObject, dir:String ):Array { 
     1410                var matched:Array = []; 
     1411                var cur:DisplayObject = Dom.getProperty(elem, dir) as DisplayObject; 
     1412                while ( cur && !(cur is Stage) ) { 
     1413                        matched.push( cur ); 
     1414                        cur = Dom.getProperty(cur, dir) as DisplayObject; 
    13561415                } 
    13571416                return matched; 
    1358         }, 
    1359          
    1360         nth: function(cur,result,dir,elem)
     1417        } 
     1418 
     1419        static public function nth( cur:DisplayObject, result:Number, dir:String, elem:DisplayObject = null):DisplayObject
    13611420                result = result || 1; 
    1362                 var num = 0; 
    1363  
    1364                 for ( ; cur; cur = cur[dir]
    1365                         if ( cur.nodeType == 1 && ++num == result ) 
     1421                var num:int = 0; 
     1422 
     1423                for ( ; cur && !(cur is Stage); cur = Dom.getProperty(cur, dir) as DisplayObject
     1424                        if ( ++num == result ) 
    13661425                                break; 
    13671426 
    13681427                return cur; 
    1369         }, 
    1370          
    1371         sibling: function( n, elem )
    1372                 var r = []; 
    1373  
    1374                 for ( ; n; n = n.nextSibling ) { 
    1375                         if ( n.nodeType == 1 && (!elem || n != elem)
     1428        } 
     1429 
     1430        static public function sibling( n:DisplayObject, elem:DisplayObject = null ):Array
     1431                var r:Array = []; 
     1432 
     1433                for ( ; n; n = Dom.nextSibling(n) ) { 
     1434                        if ( !elem || n != elem
    13761435                                r.push( n ); 
    13771436                } 
     
    13791438                return r; 
    13801439        } 
    1381 */ 
     1440 
     1441        //-------------------------------------------------------------------------- 
     1442        // 
     1443        // events 
     1444        // 
     1445        //-------------------------------------------------------------------------- 
    13821446 
    13831447        public function bind( type:String, data:Object, fn:Object = null ):aQuery { 
     
    13961460        } 
    13971461 
    1398         public function unbind( type:Object, fn:Function = null ):aQuery { 
     1462        public function unbind( type:Object = null, fn:Function = null ):aQuery { 
    13991463                return each(function(... args):void { 
    14001464                        aQueryEvent.remove( this, type, fn ); 
     
    14021466        } 
    14031467 
     1468        public function trigger( type:String, data:Array = null ):aQuery { 
     1469                return this.each(function(...args):void { 
     1470                        aQueryEvent.trigger( type, data, this ); 
     1471                }); 
     1472        } 
     1473 
     1474        public function triggerHandler( type:String, data:Array = null, fn:Function = null ):Object { 
     1475                if ( this[0] ) 
     1476                        return aQueryEvent.trigger( type, data, this[0], false, fn ); 
     1477                return null; 
     1478        } 
     1479 
     1480/*      toggle: function() { 
     1481                // Save reference to arguments for access in closure 
     1482                var a = arguments; 
     1483 
     1484                return this.click(function(e) { 
     1485                        // Figure out which function to execute 
     1486                        this.lastToggle = 0 == this.lastToggle ? 1 : 0; 
     1487                         
     1488                        // Make sure that clicks stop 
     1489                        e.preventDefault(); 
     1490                         
     1491                        // and execute the function 
     1492                        return a[this.lastToggle].apply( this, [e] ) || false; 
     1493                }); 
     1494        }, 
     1495*/ 
     1496 
     1497        public function focusOut    ( f:Function = null):aQuery { return eventImpl("focusOut", f);} 
     1498        public function focusIn     ( f:Function = null):aQuery { return eventImpl("focusIn", f);} 
     1499        public function resize      ( f:Function = null):aQuery { return eventImpl("resize", f);} 
     1500        public function scroll      ( f:Function = null):aQuery { return eventImpl("scroll", f);} 
     1501        public function click       ( f:Function = null):aQuery { return eventImpl("click", f);} 
     1502        public function doubleClick ( f:Function = null):aQuery { return eventImpl("doubleClick", f);} 
     1503        public function mouseDown   ( f:Function = null):aQuery { return eventImpl("mouseDown", f);} 
     1504        public function mouseUp     ( f:Function = null):aQuery { return eventImpl("mouseUp", f);} 
     1505        public function mouseMove   ( f:Function = null):aQuery { return eventImpl("mouseMove", f);} 
     1506        public function mouseOver   ( f:Function = null):aQuery { return eventImpl("mouseOver", f);} 
     1507        public function mouseOut    ( f:Function = null):aQuery { return eventImpl("mouseOut", f);} 
     1508        public function keyDown     ( f:Function = null):aQuery { return eventImpl("keyDown", f);} 
     1509        public function keyUp       ( f:Function = null):aQuery { return eventImpl("keyUp", f);} 
     1510        public function enterFrame  ( f:Function = null):aQuery { return eventImpl("enterFrame", f);} 
     1511 
     1512        // jQuery compatible methods 
     1513        public function focus    ( f:Function = null):aQuery { return focusIn(f);} 
     1514        public function blur     ( f:Function = null):aQuery { return focusOut(f);} 
     1515        public function dblclick ( f:Function = null):aQuery { return doubleClick(f);} 
     1516        public function mousedown( f:Function = null):aQuery { return mouseDown(f);} 
     1517        public function mouseup  ( f:Function = null):aQuery { return mouseUp(f);} 
     1518        public function mousemove( f:Function = null):aQuery { return mouseMove(f);} 
     1519        public function mouseout ( f:Function = null):aQuery { return mouseOut(f);} 
     1520        public function keydown  ( f:Function = null):aQuery { return keyDown(f);} 
     1521        public function keyup    ( f:Function = null):aQuery { return keyUp(f);} 
     1522 
     1523        private function eventImpl( type:String, f:Function = null):aQuery { 
     1524                return f != null ? bind(type, f) : trigger(type); 
     1525        } 
     1526 
     1527        //-------------------------------------------------------------------------- 
     1528        // 
     1529        // effects 
     1530        // 
     1531        //-------------------------------------------------------------------------- 
     1532 
     1533        public function addTween(obj:Object):aQuery { 
     1534                var tweener:Class = getDefinitionByName("caurina.transitions.Tweener") as Class; 
     1535                if(tweener && tweener.addTween is Function) { 
     1536                        tweener.addTween.call(null, getArray(), obj); 
     1537                } 
     1538                return this; 
     1539        } 
     1540 
    14041541        public function show(speed:Number = 0, callback:Function = null):aQuery { 
    1405                 /*return speed ? 
     1542                return speed ? 
    14061543                        animate({ 
    1407                                 height: "show", width: "show", opacity: "show" 
     1544                                height: "show", width: "show", alpha: "show" 
    14081545                        }, speed, callback) : 
    1409                         */ 
    1410                 return filter(":hidden").each(function(...args):void{ 
     1546                        filter(":hidden").each(function(...args):void{ 
    14111547                                this.visible = true; 
    14121548                        }).end(); 
     
    14141550         
    14151551        public function hide(speed:Number = 0, callback:Function = null):aQuery { 
    1416                 /*return speed ? 
     1552                return speed ? 
    14171553                        animate({ 
    1418                                 height: "hide", width: "hide", opacity: "hide" 
     1554                                height: "hide", width: "hide", alpha: "hide" 
    14191555                        }, speed, callback) : 
    1420                         */ 
    1421                 return filter(":visible").each(function(...args):void{ 
     1556                        filter(":visible").each(function(...args):void{ 
    14221557                                this.visible = false; 
    14231558                        }).end(); 
    14241559        } 
    14251560 
    1426         // Save the old toggle function 
    1427 //      _toggle: jQuery.fn.toggle, 
     1561        public function toggle( fn:Object = null, fn2:Object = null ):aQuery { 
     1562                //return //aQuery.isFunction(fn) && aQuery.isFunction(fn2) ? 
     1563                        //_toggle( fn, fn2 ) : 
     1564                return fn != null ? 
     1565                                animate({ 
     1566                                        height: "toggle", width: "toggle", alpha: "toggle" 
     1567                                }, fn, fn2) : 
     1568                        each(function(...args):void{ 
     1569                                aQuery.create(this)[ aQuery.create(this)._is(":hidden") ? "show" : "hide" ](); 
     1570                        }); 
     1571        } 
    14281572         
    1429         public function toggle():aQuery {// fn, fn2 ){ 
    1430                 /*return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? 
    1431                         this._toggle( fn, fn2 ) : 
    1432                         fn ? 
    1433                                 this.animate({ 
    1434                                         height: "toggle", width: "toggle", opacity: "toggle" 
    1435                                 }, fn, fn2) :*/ 
    1436                 return each(function(...args):void{ 
    1437                         aQuery.create(this)[ aQuery.create(this)._is(":hidden") ? "show" : "hide" ](); 
    1438                 }); 
     1573        public function slideDown(speed:Object,callback:Object = null):aQuery { 
     1574                return animate({height: "show"}, speed, callback); 
    14391575        } 
    14401576         
    1441 /*      slideDown: function(speed,callback){ 
    1442                 return this.animate({height: "show"}, speed, callback); 
    1443         }, 
     1577        public function slideUp(speed:Object,callback:Object = null):aQuery { 
     1578                return animate({height: "hide"}, speed, callback); 
     1579        } 
     1580 
     1581        public function slideToggle(speed:Object, callback:Object = null):aQuery { 
     1582                return animate({height: "toggle"}, speed, callback); 
     1583        } 
    14441584         
    1445         slideUp: function(speed,callback){ 
    1446                 return this.animate({height: "hide"}, speed, callback); 
    1447         }, 
    1448  
    1449         slideToggle: function(speed, callback){ 
    1450                 return this.animate({height: "toggle"}, speed, callback); 
    1451         }, 
     1585        public function fadeIn(speed:Object, callback:Object = null):aQuery { 
     1586                return animate({alpha: "show"}, speed, callback); 
     1587        } 
    14521588         
    1453         fadeIn: function(speed, callback)
    1454                 return this.animate({opacity: "show"}, speed, callback); 
    1455         }, 
     1589        public function fadeOut(speed:Object, callback:Object = null):aQuery
     1590                return animate({alpha: "hide"}, speed, callback); 
     1591        } 
    14561592         
    1457         fadeOut: function(speed, callback){ 
    1458                 return this.animate({opacity: "hide"}, speed, callback); 
    1459         }, 
    1460          
    1461         fadeTo: function(speed,to,callback){ 
    1462                 return this.animate({opacity: to}, speed, callback); 
    1463         }, 
    1464  
    1465         public function animate( prop:Object, speed, easing:Number, callback:Function ):aQuery { 
    1466                 var opt = aQuery.speed(speed, easing, callback); 
    1467  
    1468                 return this[ opt.queue === false ? "each" : "queue" ](function(... args):void { 
     1593        public function fadeTo(speed:Object, to:Number, callback:Object = null):aQuery { 
     1594                return animate({alpha: to}, speed, callback); 
     1595        } 
     1596 
     1597        public function animate( prop:Object, speed:Object, easing:Object, callback:Function = null ):aQuery { 
     1598                var opt:Object = aQuery.speed(speed, easing, callback); 
     1599 
     1600                return this[ opt.queue === false ? "each" : "queue" ](function(... args):Object { 
    14691601                        opt = aQuery.extend({}, opt); 
    1470                         var hidden:Boolean = jQuery(this)._is(":hidden"), self:DisplayObject = this; 
     1602                        var hidden:Boolean = aQuery.create(this)._is(":hidden"), self:DisplayObject = this; 
    14711603                         
    14721604                        for ( var p:String in prop ) { 
     
    14821614                        opt.curAnim = aQuery.extend({}, prop); 
    14831615                         
    1484                         jQuery.each( prop, function(name:String, val)
    1485                                 var e = new jQuery.fx( self, opt, name ); 
    1486  
    1487                                 if ( /toggle|show|hide/.test(val) ) 
     1616                        aQuery.each( prop, function(name:String, val:Object):void
     1617                                var e:aQueryFx = new aQueryFx( self, opt, name ); 
     1618 
     1619                                if ( /toggle|show|hide/.test( val.toString() ) ) 
    14881620                                        e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); 
    14891621                                else { 
    1490                                         var parts = val.toString().match(/^([+-]?)([\d.]+)(.*)$/), 
    1491                                                 start = e.cur(true) || 0; 
     1622                                        var parts:Array = val.toString().match(/^([+-]?)([\d.]+)(.*)$/), 
     1623                                                start:Object = e.cur(true) || 0; 
    14921624 
    14931625                                        if ( parts ) { 
    1494                                                 end = parseFloat(parts[2]), 
    1495                                                 unit = parts[3] || "px"; 
     1626                                                var end:Number = parseFloat(parts[2]), 
     1627                                                       unit:String = parts[3] || "px"; 
    14961628 
    14971629                                                // We need to compute starting value 
     
    15081640                                                e.custom( start, end, unit ); 
    15091641                                        } else 
    1510                                                 e.custom( start, val, "" ); 
     1642                                                e.custom( start, val is Number ? Number(val) : parseFloat(val.toString()), "" ); 
    15111643                                } 
    15121644                        }); 
     
    15151647                        return true; 
    15161648                }); 
    1517         }, 
    1518 */ 
    1519         public function queue(type:String, fn:Object):aQuery { 
     1649        } 
     1650 
     1651        private function queue(type:Object, fn:Object = null):aQuery { 
    15201652                if ( !fn ) { 
    15211653                        fn = type; 
     
    15251657                return each(function(... args):void { 
    15261658                        if ( fn is Array ) 
    1527                                 aQuery.queue(this, type, fn as Array); 
     1659                                aQuery.queue(this, type.toString(), fn as Array); 
    15281660                        else { 
    1529                                 aQuery.queue(this, type).push( fn ); 
     1661