返回函数的函数
很好玩的写法,也是很容易让你的团队伙伴崩溃的写法。复制到你的Flash里试试。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | var connect:Function = function(xp:Number, yp:Number, col:uint=0):Function{ graphics.lineStyle(0,col); graphics.moveTo(xp, yp); var line:Function = function(xp:Number, yp:Number):Function{ graphics.lineTo(xp, yp); return line; } return line; } // draw a triangle connect(200,100)(300,300)(100,300)(200, 100); // draw a box connect(100,100, 0xFF0000)(150,100)(150,150)(100, 150)(100,100); |
来自:Actinsnippet
11月 24th, 2009 at 05:25
真有趣。
11月 24th, 2009 at 09:57
看着就晕…
12月 22nd, 2009 at 02:46
挺好!~:)