Flex2.0不再僅僅是Web應用或者顯示服務器。它是一個框架。
你不再需要象Flex1.5那樣需要一個Server,不需要在瀏覽器的URL中輸入mxml后綴的請求來查看。可以直接把SWF文件放到Web目錄下即可。這一句話是重點啊。
這意味著什么呢? Flex開始免費了?。?BR>因為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取代.