チェンジセット 186
- コミット日時:
- 2008/01/02 21:30:30 (1 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/aQuery/src/com/nitoyon/aquery/Dom.as
r183 r186 7 7 static public function firstChild( node:DisplayObject):DisplayObject { 8 8 if ( node is DisplayObjectContainer ) { 9 return DisplayObjectContainer( node ).getChildAt(0); 9 var c:DisplayObjectContainer = DisplayObjectContainer(node); 10 return c.numChildren ? c.getChildAt(0) : null; 10 11 } 11 12 12 13 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); 13 20 } 14 21 … … 27 34 } 28 35 29 static public function getElementsByTagName( tagName:String, parent:DisplayObject Container= null, arr:Array = null ):Array {36 static public function getElementsByTagName( tagName:String, parent:DisplayObject = null, arr:Array = null ):Array { 30 37 parent = parent || aQuery.stage; 31 38 arr = arr || []; 32 39 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 ); 36 44 37 45 if ( nodeNameCmp( n, tagName ) ) … … 44 52 return arr; 45 53 } 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 } 46 59 } 47 60 } as3/aQuery/src/com/nitoyon/aquery/aQuery.as
r185 r186 13 13 import flash.display.DisplayObjectContainer; 14 14 import flash.display.Stage; 15 import com.nitoyon.aquery.aQueryFx; 15 16 16 17 public class aQuery extends Proxy { 18 19 //-------------------------------------------------------------------------- 20 // 21 // core 22 // 23 //-------------------------------------------------------------------------- 24 17 25 private static var quickExpr:RegExp = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; 18 26 … … 33 41 } 34 42 35 static internalfunction create(... args):aQuery {43 static public function create(... args):aQuery { 36 44 var a:Object = args[0] || _stage; 37 45 var c:Object = args[1]; … … 56 64 throw new Error(); 57 65 // HANDLE: $(XML) 58 } else if( a is XML ) {66 } else if( a is XML || a is XMLList ) { 59 67 a = aQuery.clean( [ a ]); 60 68 // HANDLE: $(Class) … … 87 95 } 88 96 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 89 105 public const aquery:String = "1.2"; 90 106 … … 102 118 return num == -1 ? 103 119 104 // Return a 'clean' array 105 aQuery.makeArray( this ) : 120 getArray() : 106 121 107 122 // Return just the object 108 123 this[num]; 124 } 125 126 public function getArray():Array { 127 // Return a 'clean' array 128 return aQuery.makeArray( this ); 109 129 } 110 130 … … 126 146 127 147 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 ); 133 149 } 134 150 … … 178 194 } 179 195 180 /* wrapAll: function(html){196 public function wrapAll(html:String):aQuery { 181 197 if ( this[0] ) 182 198 // The elements to wrap the target around 183 aQuery (html, this[0].ownerDocument)199 aQuery.create(html, this[0].stage) 184 200 .clone() 185 201 .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); 190 206 return elem; 191 207 }) … … 193 209 194 210 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 209 225 static private const props:Object = { 210 226 "for": "htmlFor", … … 223 239 }; 224 240 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 225 302 public function append(... args):aQuery { 226 303 return domManip(args, true, 1, function(a:DisplayObject):void{ … … 257 334 } 258 335 259 /* clone: function(events){336 public function clone(events:Boolean = false):aQuery { 260 337 // 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; 263 340 }); 264 341 265 342 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); 273 350 }); 274 351 } … … 276 353 // Return the cloned set 277 354 return ret; 278 } ,279 */ 355 } 356 280 357 public function filter(t:Object):aQuery { 281 358 return pushStack( … … 386 463 } 387 464 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 392 469 public function slice(...args):aQuery { 393 470 return pushStack( _array.slice.apply( this, args ) ); … … 404 481 } 405 482 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" ) 408 486 var clone:Boolean = length > 1, a:Array; 409 487 … … 418 496 419 497 aQuery.each( a, function():void{ 420 fn.apply( obj, [ clone ? cloneObject(this) : this ] );498 fn.apply( obj, [ clone ? aQuery.cloneObject(this) : this ] ); 421 499 }); 422 500 }) as aQuery; 423 501 } 424 502 425 private function cloneObject(source:Object):Object {503 static private function cloneObject(source:Object):Object { 426 504 var cls:Class = getDefinitionByName(getQualifiedClassName(source)) as Class; 427 505 if(cls) { … … 436 514 437 515 public function extend( ...args ):Object { 438 // extend jQuery itself if only one argument is passed439 if ( args.length == 1 ) {440 return aQuery.extend( this, args[0] );441 }442 443 516 return aQuery.extend.apply( null, args ); 444 517 } … … 480 553 private static var expando:String = "aQuery" + (new Date()).getTime(); 481 554 482 /* noConflict: function(deep) {483 window.$ = _$;484 if ( deep )485 window.aQuery = _aQuery;486 return aQuery;487 },488 */489 490 555 static public function isFunction(fn:Object):Boolean 491 556 { … … 499 564 } 500 565 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 520 570 static private var cache:Dictionary = new Dictionary(); 521 571 … … 759 809 arg = arg.toString(); 760 810 761 // Convert html string into XML 811 // Convert html string into XMLList 762 812 if ( arg is String ) { 763 813 try { 764 arg = XML (arg.toString());814 arg = XMLList(arg.toString()); 765 815 } catch (e:*) { 766 816 throw new Error("XML Parse error!!!"); … … 769 819 770 820 // Convert XML into DisplayObjects 771 if ( arg is XML ) {821 if ( arg is XML || arg is XMLList ) { 772 822 var fn:Function = function(xml:XML):DisplayObject { 773 823 try { … … 799 849 }; 800 850 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 } 804 858 } 805 859 } … … 809 863 r.push( arg ); 810 864 else 811 r = aQuery.merge( r, a rg as Array);865 r = aQuery.merge( r, aQuery.makeArray( arg ) ); 812 866 }); 813 867 … … 960 1014 });*/ 961 1015 1016 //-------------------------------------------------------------------------- 1017 // 1018 // selector 1019 // 1020 //-------------------------------------------------------------------------- 1021 962 1022 static private const chars:String = "(?:[\\w*_-]|\\\\.)"; 963 1023 static private const quickChild:RegExp = new RegExp("^>\\s*(" + chars + "+)"); … … 966 1026 967 1027 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])}, 969 1029 // "#": function(a:DisplayObject,i:int){return a.getAttribute('id')==m[2]}, 970 1030 ":": { … … 989 1049 990 1050 // 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}, 992 1052 993 1053 // Visibility 994 1054 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}, 996 1056 997 1057 /* // Form attributes … … 1000 1060 checked: function(a:DisplayObject,i:int){return a.checked}, 1001 1061 selected: function(a:DisplayObject,i:int){return a.selected||aQuery.attr(a,'selected')}, 1002 1062 */ 1003 1063 // 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}, 1006 1066 checkbox: function(a:DisplayObject,i:int){return 'checkbox'==a.type}, 1007 1067 file: function(a:DisplayObject,i:int){return 'file'==a.type}, … … 1012 1072 button: '"button"==a.type||aQuery.nodeName(a,"button")', 1013 1073 input: function(a:DisplayObject,i:int){return (/input|select|textarea|button/i).test(a.nodeName)}, 1014 1074 */ 1015 1075 // :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}, 1017 1077 1018 1078 // :header 1019 header: function( a:DisplayObject,i:int){return (/h\\d/i).test(a.nodeName)},1079 header: function(...args):Boolean{return false} 1020 1080 1021 1081 // :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}*/ 1023 1083 } 1024 1084 }; … … 1049 1109 } 1050 1110 1051 static p rivatefunction find( t:String, context:DisplayObject = null ):Array {1111 static public function find( t:String, context:DisplayObject = null ):Array { 1052 1112 // Set the correct context (if none is provided) 1053 1113 context = context || _stage; … … 1220 1280 } 1221 1281 1222 static p rivatefunction classFilter(r:Array,m:String,not:Boolean = false):Array {1282 static public function classFilter(r:Array,m:String,not:Boolean = false):Array { 1223 1283 m = " " + m + " "; 1224 1284 var tmp:Array = []; … … 1234 1294 } 1235 1295 1236 static p rivatefunction filter(t:String,r:Array,not:Boolean = false):Object {1296 static public function filter(t:String,r:Array,not:Boolean = false):Object { 1237 1297 var last:Object; 1238 1298 … … 1347 1407 } 1348 1408 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; 1356 1415 } 1357 1416 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 { 1361 1420 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 ) 1366 1425 break; 1367 1426 1368 1427 return cur; 1369 } ,1370 1371 s ibling: 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 ) 1376 1435 r.push( n ); 1377 1436 } … … 1379 1438 return r; 1380 1439 } 1381 */ 1440 1441 //-------------------------------------------------------------------------- 1442 // 1443 // events 1444 // 1445 //-------------------------------------------------------------------------- 1382 1446 1383 1447 public function bind( type:String, data:Object, fn:Object = null ):aQuery { … … 1396 1460 } 1397 1461 1398 public function unbind( type:Object , fn:Function = null ):aQuery {1462 public function unbind( type:Object = null, fn:Function = null ):aQuery { 1399 1463 return each(function(... args):void { 1400 1464 aQueryEvent.remove( this, type, fn ); … … 1402 1466 } 1403 1467 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 1404 1541 public function show(speed:Number = 0, callback:Function = null):aQuery { 1405 /*return speed ?1542 return speed ? 1406 1543 animate({ 1407 height: "show", width: "show", opacity: "show"1544 height: "show", width: "show", alpha: "show" 1408 1545 }, speed, callback) : 1409 */ 1410 return filter(":hidden").each(function(...args):void{ 1546 filter(":hidden").each(function(...args):void{ 1411 1547 this.visible = true; 1412 1548 }).end(); … … 1414 1550 1415 1551 public function hide(speed:Number = 0, callback:Function = null):aQuery { 1416 /*return speed ?1552 return speed ? 1417 1553 animate({ 1418 height: "hide", width: "hide", opacity: "hide"1554 height: "hide", width: "hide", alpha: "hide" 1419 1555 }, speed, callback) : 1420 */ 1421 return filter(":visible").each(function(...args):void{ 1556 filter(":visible").each(function(...args):void{ 1422 1557 this.visible = false; 1423 1558 }).end(); 1424 1559 } 1425 1560 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 } 1428 1572 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); 1439 1575 } 1440 1576 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 } 1444 1584 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 } 1452 1588 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 } 1456 1592 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 { 1469 1601 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; 1471 1603 1472 1604 for ( var p:String in prop ) { … … 1482 1614 opt.curAnim = aQuery.extend({}, prop); 1483 1615 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() ) ) 1488 1620 e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); 1489 1621 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; 1492 1624 1493 1625 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"; 1496 1628 1497 1629 // We need to compute starting value … … 1508 1640 e.custom( start, end, unit ); 1509 1641 } else 1510 e.custom( start, val , "" );1642 e.custom( start, val is Number ? Number(val) : parseFloat(val.toString()), "" ); 1511 1643 } 1512 1644 }); … … 1515 1647 return true; 1516 1648 }); 1517 } ,1518 */ 1519 p ublic function queue(type:String, fn:Object):aQuery {1649 } 1650 1651 private function queue(type:Object, fn:Object = null):aQuery { 1520 1652 if ( !fn ) { 1521 1653 fn = type; … … 1525 1657 return each(function(... args):void { 1526 1658 if ( fn is Array ) 1527 aQuery.queue(this, type , fn as Array);1659 aQuery.queue(this, type.toString(), fn as Array); 1528 1660 else { 1529 aQuery.queue(this, type ).push( fn );1661