2010
3-10
如题,这样的代码可读性很差,在这发出来只是提醒一下新手,不是说写的出这种代码才是厉害,真正项目中,要是你写这样的代码,是会被同事群殴,甚至是被炒鱿鱼的!
评论Feed: http://www.xiaos8.com/feed.asp?q=comment&id=544
var image:Sprite = (addChild(new Sprite) as Sprite).addChild(new ColorImage).parent as Sprite;
image.addEventListener(MouseEvent.MOUSE_DOWN,function():void{image.startDrag()});
stage.addEventListener(MouseEvent.MOUSE_UP,function():void{image.stopDrag()});
stage.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{if(event.ctrlKey) traceText.appendText((image.getChildAt(0) as Bitmap).bitmapData.getPixel(event.localX,event.localY).toString(16) + ",")});
题外话:早几天无意中看到一封帖子,无限膜拜这种一行代码的写法,因此拿出来醒个目。
image.addEventListener(MouseEvent.MOUSE_DOWN,function():void{image.startDrag()});
stage.addEventListener(MouseEvent.MOUSE_UP,function():void{image.stopDrag()});
stage.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{if(event.ctrlKey) traceText.appendText((image.getChildAt(0) as Bitmap).bitmapData.getPixel(event.localX,event.localY).toString(16) + ",")});
[最后修改由 sunbright, 于 2010-03-10 12:17:31]
评论Feed: http://www.xiaos8.com/feed.asp?q=comment&id=544
快速浏览
类别
标题
评论/流量
日期


你又开始做好人了

- 查看svn更新内容以及最新状态(实时更新)
- 查看框架API文档(09.6.15更新)
- 查看框架代码(09.4.20更新)
框架暂停开发,且没有完全竣工,目前只能使用air包和library包!