AS3的通用工具类库 GhostCat

jopen 12年前
     <p>GhostCatTools已经发布,使用Flex Spark框架以及AIR和部分<a href="/misc/goto?guid=4959500942358252923">GhostCat</a>功能制作。 包含大量开发常用的功能。<br /> <img alt="AS3的通用工具类库 GhostCat" src="https://simg.open-open.com/show/385bd85ca0d7af833debea2e9a9b58cc.jpg" width="533" height="566" /><br /> 下载地址:<a href="/misc/goto?guid=4959500942440577577" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/GhostCatTools/GhostCatTools.exe</a> </p>    <p><img alt="AS3的通用工具类库 GhostCat" src="https://simg.open-open.com/show/b47dcb7d0dbadc432f791e716873dd2c.gif" width="116" height="69" /><br /> <a href="/misc/goto?guid=4959500942358252923">GhostCat</a>是一个功能非常丰富的开源工具库,(同时也包含有一套完整的UI组件,但它只是类库的一个衍生品。)<br /> 它基本可以涵盖你可能遇到大部分问题。<br /> 使用UI将会增加50K左右的体积,使用非UI显示对象会增加20K以上的体积,而非显示类可以非常小。<br /> <br /> <a href="/misc/goto?guid=4959500942358252923">GhostCat</a>采用BSD协议可以自由地应用于商业及非商业应用中。如果您使用了<a href="/misc/goto?guid=4959500942358252923">GhostCat</a>,甚至用于实际项目中,希望能通过邮件给予回馈。<br /> </p> http://code.google.com/p/ghostcat/    <p>实际应用项目<br /> </p>    <p>升职记 CeoDream<br /> <a href="http://app.pengyou.qq.com/appframe.html?appid=608&height=950&frame=http%3A%2F%2Fceo.qzoneapp.com%2Findex.php" rel="nofollow">http://app.pengyou.qq.com/appframe.html?appid=608&height=950&frame=http%3A%2F%2Fceo.qzoneapp.com%2Findex.php</a><b> <a href="/misc/goto?guid=4959500942628385534" rel="nofollow">http://apps.renren.com/ceodream</a><br /> <a href="/misc/goto?guid=4959500942711545014" rel="nofollow">http://apps.非死book.com/ceodream</a><br /> </b></p>    <p><b><a href="/misc/goto?guid=4959500942358252923">GhostCat</a> is a feature-rich open source tools for libraries, (which also contains a complete set of UI components, but it is only a class library derivatives.) <br /> It basically can cover most of the problems you may encounter. <br /> Using the UI will increase the size of 50K or so, use of non-UI display object will increase more than 20K in size, rather than display type can be very small. <br /> <br /> <a href="/misc/goto?guid=4959500942358252923">GhostCat</a> using BSD agreement may be freely used in commercial and non-commercial applications. If you use a <a href="/misc/goto?guid=4959500942358252923">GhostCat</a>, even for the actual project, we hope to give feedback through e-mail. <br /> </b></p>    <p><b>The practical application of project<br /> </b></p>    <p><b>renren.com: ceo dream<br /> <a href="http://apps.renren.com/ceodream?origin=103&_vip_flag=32" rel="nofollow">http://apps.renren.com/ceodream?origin=103&_vip_flag=32</a><br /> </b></p>    <p><b>@author flashyiyi<br /> blog:<a href="/misc/goto?guid=4959500942911922901" rel="nofollow">http://uh.actionscript3.cn/space.php?uid=12147</a><br /> </b></p>    <p><b>参考<br /> <a href="/misc/goto?guid=4959500942991592593" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/GhostCat/asdoc-output.chm</a><br /> </b></p>    <p><b>SWC下载<br /> <a href="/misc/goto?guid=4959500943068879511" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/GhostCat/bin/GhostCat.swc</a><br /> </b></p>    <p><b>SVN工具<br /> <a href="/misc/goto?guid=4958343436125595150" rel="nofollow">http://tortoisesvn.net/downloads.html</a> </b></p>    <p><b>教程可查看wiki<br /> </b></p>    <p><b>示例(打不开就用IE):<br /> <a href="/misc/goto?guid=4959500943188920371" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/AStarExample.swf</a><br /> <a href="/misc/goto?guid=4959500943262747721" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/BindingExample.swf</a><br /> <a href="/misc/goto?guid=4959500943347540832" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/CollisionExample.swf</a><br /> <a href="/misc/goto?guid=4959500943425137460" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/ControlRectExample.swf</a><br /> <a href="/misc/goto?guid=4959500943501140293" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/GIFExample.html</a><br /> <a href="/misc/goto?guid=4959500943586639238" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/GXMLExample2.swf</a><br /> <a href="/misc/goto?guid=4959500943663397556" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/GXMLExample.swf</a><br /> <a href="/misc/goto?guid=4959500943745853668" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/IFrameExample.html</a><br /> <a href="/misc/goto?guid=4959500943830531152" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/IMEExample.swf</a><br /> <a href="/misc/goto?guid=4959500943904489984" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/LangageExample.html</a><br /> <a href="/misc/goto?guid=4959500943994294823" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/LightExample.swf</a><br /> <a href="/misc/goto?guid=4959500944068977128" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/Paper3DExample.swf</a><br /> <a href="/misc/goto?guid=4959500944148620368" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/RightClickExample.html</a><br /> <a href="/misc/goto?guid=4959500944222685976" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/SkewExample.swf</a><br /> <a href="/misc/goto?guid=4959500944302726923" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/SmoothCurveExample.swf</a><br /> <a href="/misc/goto?guid=4959500944388376264" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/SWFDecoderExample.swf</a><br /> <a href="/misc/goto?guid=4959500944472454767" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/TestExample.swf</a><br /> <a href="/misc/goto?guid=4959500944546324543" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/Tile45Example.swf</a><br /> <a href="/misc/goto?guid=4959500944627163020" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/TileExample.swf</a><br /> <a href="/misc/goto?guid=4959500944705612917" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/TweenExample.swf</a><br /> <a href="/misc/goto?guid=4959500944786577079" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/SortExample.swf</a><br /> <a href="/misc/goto?guid=4959500944866997343" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/EllipseLayoutExample.swf</a><br /> <a href="/misc/goto?guid=4959500944945679860" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/PixelExample.swf</a><br /> <a href="/misc/goto?guid=4959500945029875633" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/TableExample.swf</a><br /> <a href="/misc/goto?guid=4959500945265927406" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/StringTweenExample.swf</a><br /> <a href="/misc/goto?guid=4959500945339320031" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/BitmapScreenExample.swf</a><br /> <a href="/misc/goto?guid=4959500945428133906" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/SoundExample.html</a><br /> <a href="/misc/goto?guid=4959500945507926080" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/TransitionExample.swf</a><br /> <a href="/misc/goto?guid=4959500945586136163" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/FrameRateExample.swf</a><br /> <a href="/misc/goto?guid=4959500945670669864" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/WalkExample.swf</a><br /> <a href="/misc/goto?guid=4959500945748749989" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/MazeExample.swf</a><br /> <a href="/misc/goto?guid=4959500945860050965" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/BombExample.swf</a><br /> </b></p>    <p><b>几个简单的UI示例<br /> <a href="/misc/goto?guid=4959500945980385502" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/UIBoxExample.swf</a><br /> <a href="/misc/goto?guid=4959500946098841448" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/UIBuilderExampler.swf</a><br /> <a href="/misc/goto?guid=4959500946223832048" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/UIComboBoxExample.swf</a><br /> <a href="/misc/goto?guid=4959500946345589631" rel="nofollow">http://ghostcat.googlecode.com/svn/trunk/example/bin-release/UIScrollExample.swf</a><br /> </b></p>    <hr />    <p><b><a href="/misc/goto?guid=4959500942358252923">GhostCat</a>原 名ASGameUI,初期设计只是想做一个轻量化的UI组件库。FLEX暂且不提,就算AsWing实际上都未能实现和Sprite的完美结合,而且体积 依然很抱歉。因此,很多开发者最终被迫选择了自行开发。然而,他们开发的东西要不功能不够,不要是针对性工具,缺乏通用性,因此并无法补齐这个空缺。<br /> ASGameUI来源于一个“逻辑注入”的设想,牺牲了布局的便利性,并充分利用FLASH IDE为自身服务,使得它在符合面向对象的编程方式的同时,亦实现了和原始时间线开发类似的自由度和便利性,从而可以在纯代码环境下直接套用原本动画网站 丰富的表现方式,达到两种互斥方式的结合。从而,使得在开发丰富表现的UI时,开发成本大幅度降低。<br /> 值得一提的是,虽然<a href="/misc/goto?guid=4959500942358252923">GhostCat</a>在底层引入了与UI无关的大量内容,在使用UI时体积依然只有50K出头(不使用UI会很低)。这主要来源于松散的类库设计。你可以将大量内容引用,并在项目中充分使用其功能,也可以仅仅引用一个功能点,你并不会因为引入了一个功能而使得SWF体积大幅度上升。<br /> <a href="/misc/goto?guid=4959500942358252923">GhostCat</a>的UI充分考虑了其表现。除了亲和<a href="/misc/goto?guid=4959500946518376098">MovieClip</a>之外,它同时在组件内部自带了缓动和动画效果。这是目前其他类库所没有的。而且,和一些自写类库相比,<a href="/misc/goto?guid=4959500942358252923">GhostCat</a>在控制体积的同时,亦提供了布局,List,ItemRender等高级特性,使得它在基本功能上同样不亚于ASWing,FLEX等组件,仅仅是效率和便利程度上不及。<br /> <br /> <a href="/misc/goto?guid=4959500942358252923">GhostCat</a>之所以改名,是因为这个类库目前已经远远超出了UI的概念。它利用自己的基层类库进行发散,诞生了许多有用而独特的功能,诸如:<br /> <br /> 提供了<a href="/misc/goto?guid=4959500946518376098">MovieClip</a>的扩展:<br /> 你可以用同一种方式操作矢量动画,位图动画,以及代码动画并可将动画进行拼接处理。动画自带倒放,帧速控制,播放队列功能,并可将矢量动画转换为位图动画播放。<br /> <br /> 一个奇特的动态内容显示模块:<br /> 可以很简单的使用(你可以假想它只是一个超大的重复内容图形),由它自动进行重复对象的创建,移动,删除,完美处理缩放和移动。而且,它甚至是List实 现的基础!仅仅是重写了几个方法,它便可以立即实现45度角的游戏地图效果。你也可以把它仅仅作为一个逻辑类,并利用事件,实现你想要的任何功能。<br /> <br /> 一个非常完善的XML反序列化器:<br /> 你可以用它表述任何种类的类(可以包含构造函数参数列表),并且模仿FLEX实现了事件自动监听,属性外链等功能。可以是多层显示对象的序列化,也可以是 一组包含复杂类的数据。扩展它也很简单。你只需要理解并重写它的3个方法,而如果仅仅是想进行属性名称的转义,只需要设置一个属性即可,而这也是自定义解 析器最常见的需求。<br /> <br /> 一个通用型队列系统:<br /> 它不仅仅用来进行资源的排队加载,而且可以排队任何东西!函数,声音,弹窗,以及判断,转向,循环。某种程度上,它甚至像是一个脚本引擎。而使用和扩展亦 非常简单。使用它,new,然后commit()即可,要扩展它,你只需要实现一个普通的命令模式,有效代码可以只有几行。作为例子,我已经提供了一个简 单的任务系统,在这种需求里,命令模式的优势被表现得淋漓尽致。这也是一个处理AS3没有多线程时的代替方案。<br /> <br /> 一个简便的位图引擎:<br /> 是的,虽然同样是addChild,但通过这种方式加上去的东西,就是用自带的优化渲染方式实现的。在大量物品移动时,它可以比默认渲染方式获得更好的性 能。并且,它还可以即时地在多种渲染模式内切换,使用风险较低。位图引擎亦实现了基本的鼠标事件模拟功能。从这个地方开始扩展,提供了一个使用很简单的位 图特效类,只需要一个行代码和简单的设置便可让对象拥有平滑残影和扩散特效。再配合物理类,便可以形成一个完整的粒子引擎。<br /> <br /> <a href="/misc/goto?guid=4959500942358252923">GhostCat</a>的功能远不止上面所说,事实上,大部分的通用功能它都已经在内部获得了实现(诸如Tween),这些就不就再提了。仅仅列出一些特殊功能。<br /> -判断矢量边缘实现不规则物品碰撞检测(非位图)<br /> -高效位图碰撞及重叠矢量检测<br /> -A星,深/广度,2D/3D/路点,寻路方式统一处理。<br /> -二次贝尔法曲线,按长度切割和计算法线,光滑曲线拟合(过点或者不过点)<br /> -SWF解析器,从ByteArray中播放声音,直接控制AVM1的动画类容。<br /> -丰富的文本缓动,部分文字Filter,渐变色文字,字符差异对比,ANSI转码,URL解码,中文数字,拼音码,这是一个单独的底层包<br /> -完全由FLASH实现的拼音输入法,需要加载200K的词库,光标跟随并可词语输入(感觉和智能ABC差不多)<br /> -缩略图,倒影,梯形变换,马赛克,各种特效,火焰什么的<br /> -完整功能的自定制过渡,不仅能用,也能创造。如果不会用,可以使用Creater中的模板<br /> -粒子,物理,景深<br /> -像QQ那样截屏!<br /> -流方式读取文本和图片。HTML可以,FLASH也可以<br /> -和FXG类似的道理,用对象保存绘制操作,简化绘制过程<br /> -多种拖拽工具,变形工具,编辑形状工具。单个拖动点也可单独使用。<br /> -单文件自加载<br /> -右键,双击,三击,键盘管理,鼠标手势<br /> -影子生成器。FLASH也是可以模拟出效果不错的光影的。影子可以折墙壁<br /> -防客户端修改解决方案(内存修改,加速)<br /> -切割图形,同时支持矢量,位图,而且,你可以按45度角来切!<br /> -颜色模式转换<br /> -去背景,魔法棒<br /> -图文混排的简单实现。也可以显示Table表格<br /> -滤镜代理:修改了滤镜的属性便能立即生效,你可以直接对它Tween!当然,水波放大镜,对比度饱和度顺便也提供了。<br /> -常用的JS扩展:IFrame,便捷的提供接口给外部JS,调用浏览器音乐播放器播放MID,以及一些常用的防刷新,防鼠标滚轮干扰。当然,deeplink是不可少的。<br /> -扇形,圆环,虚线<br /> -四则运算(字符串分析) <br /> FP10限定<br /> -Beep音乐,变速播放<br /> </b></p>    <p><b>也许在使用上,<a href="/misc/goto?guid=4959500942358252923">GhostCat</a>还是需要一些成本(至少你需要知道各个功能都在哪个位置),但是这是值得的,一些问题可能你现在不会遇到,将来也可能会遇到。这是一件一劳永逸的事情。同时,我也希望<a href="/misc/goto?guid=4959500942358252923">GhostCat</a>也能给你一些启发,让你去做一些以前认为无法做到或者过于麻烦而不去做的事,如此,提高FLASH产品的质量,从而促进行业发展,使所有人受益。 </b></p>    <br />    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326765617593" target="_blank">http://www.open-open.com/lib/view/home/1326765617593</a></p>