本文介绍了闪光的ActionScript 3的能力欠缺在ActionScript 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从推出的Adobe的ActionScript 3的Flash Player 9,我们很多人却迟迟没有切换。总之,我想知道是什么AS3作为一个框架可以做的,这是根本不可能或AS2显著困难。我说的不是现成的组件,而内置类如Web远程通信,二进制数据处理,XML处理等。

Ever since Adobe introduced ActionScript 3 with Flash Player 9, many of us have been slow to switch over. In short I'd like to know what AS3 as a framework can do, that is simply impossible or significantly difficult in AS2. I'm not talking about readymade components, but built-in classes such as for web remoting, binary data manipulation, XML handling, etc.

推荐答案

嗯,实际上,AS3是一种语言,而不是一个框架...... Flash Player的API有框架,比如特质......不过没关系,我们不要争论术语......有啥爽在Flash Player 9(除已经提及的事情等)?

well, actually, AS3 is a language, not a framework ... the flash player API has framework like traits ... but ok, let's not argue about terminology ... so what's cool in flash player 9 (other than things that were mentioned already)?

  • 的几个语言功能让您的生活轻松了许多的:方法闭包(不需要委派),可选参数(可以节省大量的时间相比,AS2可选参数,这是相当一个黑客),例如范围解析(你可以从该实例的方法中声明一个匿名函数中访问实例的成员,因此不需要无功自我=这一点;)
  • 通用API的设计的:API是干净多了,理智包装,已常数正确定义(在很多类,如 flash.filters.BitmapFilterType ) ,并公开了很多更多的事情,并提供正确的错误处理
  • 包flash.net
    • 插槽:真​​正的插座,而不是XML插座......这样就可以实现任何基于TCP的协议
    • URLStream :这其实是相当强大的,但就个人而言,我总是用插座,而不是
    • a couple of language features making your life A LOT easier : method closures (no need for Delegate), optional arguments (saves a lot of time compared to AS2 optional arguments, which are rather a hack), instance scope resolution (you can access members of an instance from within an anonymous function declared in a method of that instances, so no need for var self = this;)
    • general API design : API is much cleaner, sensibly packaged, has constants properly defined (in many classes like flash.filters.BitmapFilterType), and exposes quite a lot more things, and offers proper error handling
    • package flash.net:
      • Socket: real sockets, instead of XML sockets ... this allows any TCP based protocol to be implemented
      • URLStream: this is actually quite powerfull, but personally, i always use sockets instead
      • 装载机:: loadBytes :允许生成SWF在运行时使用ActionScript,并直接加载到播放器,以及手动缓存
      • 舞台::帧率:最后,你可以在运行时改变它
      • 的DisplayObject ::的getBounds &放大器; 的DisplayObject :: getRect :好多了,比用AS2相当于这个令人难以置信的愚蠢的返回值摆弄周围...
      • Loader::loadBytes: allows to generate swf at runtime with ActionScript and load them into the player directly, as well as manual caching
      • Stage::frameRate: finally, you can change it at runtime
      • DisplayObject::getBounds & DisplayObject::getRect: much better, than fiddling around with this incredibly stupid return value of the AS2 equivalent ...
      • 的ByteArray :操纵合理的时间二进制数据......这使得JPG或PNG COM pression,PDF创建的客户端,等等
      • 词典:允许映射对象的对象......这可以进来非常方便(你可以砍的到AS2,但是这不是你的问题,对不对? )...例如,这是伟大创造套,或将对象映射到处理程序,等等。
      • 代理:代理类是该死的强大,这么多好玩,真的......用它来做代理,收藏,AOP等..
      • 定时器:好了,现在这个可以很容易地被重新实现在AS2,但除此之外,我认为它比摆弄arount与更清洁的setInterval ...
      • ByteArray: manipulation of binary data in reasonable time ... this allows JPG or PNG compression, PDF creation on client side, and so on
      • Dictionary: allows mapping objects to objects ... this can come in very handy (you could hack that into AS2, but that wasn't your question, right?) ... for example, this is great for creating sets, or mapping objects to handlers, etc.
      • Proxy: the proxy class is so damn powerful and so much fun to play with, really ... use it for proxies, collections, AOP, etc. ...
      • Timer: ok, now this can quite easily be reimplemented in AS2, but apart from that, i think it's much cleaner than fiddling arount with setInterval ...
      • 文本字段:更大的API,允许许多很酷的事情,因为越来越字符/行规格等...
      • Font.registerFont :允许嵌入字体在运行时
      • 在整体设计更清洁,强大
      • TextField: much bigger API, allows many cool things, as getting character/line metrics, etc. ...
      • Font.registerFont: allows embedding fonts at runtime
      • overall design is much cleaner and powerful

      注意,事件模型,并diplay列表,可以在AS2额外的性能代价来重新实现,但我认为这是有关内置功能...

      note that event model and diplay list can be reimplemented in AS2 at additional performance cost, but i think it was about built-in features ...

      我想,仅此而已......

      i think, that's about it ...

      这篇关于闪光的ActionScript 3的能力欠缺在ActionScript 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 17:58
查看更多