Flex2.0不再仅仅是Web应用或者显示服务器。它是一个框架。
你不再需要象Flex1.5那样需要一个Server,不需要在浏览器的URL中输入mxml后缀的请求来查看。可以直接把SWF文件放到Web目录下即可。这一句话是重点啊。
这意味着什么呢? Flex开始免费了!!
因为Flex将免费发布Flex SDK,即可以免费将mxml编译生成swf
在Flex2.0不需要再象1.5那样需要Flex的Server了。
Don't think of Flex as a web application or a presentation server any more. It isn't. Flex 2 is a lot more. And the heart of Flex 2 is the framework.
Flex Framework 2, as it's officially called, is a programming model, a set of components and class libraries that make building Rich Internet Applications easy.
This framework is included with the all new Eclipse-based Flex Builder 2 IDE. There is still a server component in the Flex 2 product line,
Flex Enterprise Services 2, but its capabilities are focused around messaging and enterprise data services.
You read that right. With Flex 2 you won’t need to purchase a server to build applications that use Flex Framework.
This might take a little getting used to, because you've been putting MXML files into a web directory and requesting them with a browser to see how they run.
Well, you don't need to do that anymore. What you do now is either run them from within Flex Builder 2 or use the command-line compiler mxmlc.
The end result is a SWF file that you deploy inside your favorite web server.
修改分为以下几个部分:
一.使用方法上2.0与1.5是不同的, 比如: Application.alert() 修改为 Alert.show()
二.增加了存取限制符, 即public, private, ... 更加强化了OO的概念
三.添加了类型限定. 所有的变量,属性,方法,返回值都必须指定类型,
在1.5中: var s = "page"; 是可以的, 但是在2.0中必须写成: public var s:String = "page";
四.事件的修改
派发自定义事件时必须new Event而不是使用通用对象, 比如: click="dispatchEvent(new Event('checkOut'))"
监听器不再需要Delegate了, 1.5中 b1.addEventListener(“click”, mx.utils.Delegate.create(this,myListener));
在2.0中可以改为:b1.addEventListener(MouseEvent.CLICK, myListener);
五. 所有的ActionScript组件都要封装到package中, 可以使用匿名package, 但是package语句必须是组件定义文件的第一行.
package {
public class MyClass {
// Class definition
}
} // Close package
六. RemoteObject在2.0中不能继续使用了.
七. 图形组件, 在2.0中如果要使用图形,必须下载单独的swc
八. ActionScript由2.0升级为3.0
九. Flex Framework进行了升级修改, 部分类被新类所代替, 比如:MediaDisplay被VideoDisplay取代.