zoukankan      html  css  js  c++  java
  • 2010年8月18日周三_Migrating from 1.3 to 2.0_5

    /*****************************************************************************************************/

    //Migrating from 1.3 to 2.0

    //Version 2.0   

    //2010年8月18日周三

    /****************************************************************************************************/

    This page contains three separate sections:

    //这里包含三个独立的部分

    Changed requirements

    Upgrading your Flex API application code from 1.3 to 2.0

    Upgrading your Adobe Flex 3 SDK code to Flex 4 SDK

    使用环境的要求

    更新你的Flex API应用程序代码,从1.3更新到2.0

    将你的Adobe Flex 3 SDK代码更新到FLEX 4.0代码

    Changed requirements

    Flash Player 10

    As part of the move to Flex 4 SDK, Flash Player 10 is now required.

    使用环境的改变

    FLASH Player 10

    因为部分的SDK已经升级到Flex 4.0,因此现在要求安装Flash Player 10

    Flex 4 SDK

    Using Flex 4 SDK instead of Flex 3 SDK

    The ArcGIS API for Flex 2.0 requires compiling your code with Flex SDK 4 or above.

    Flex 4.0 开发包

    使用Flex 4.0开发包代替Flex 3.0开发包

    ArcGIS API for Flex 2.0需要FLEX SDK4.0或者4.0以后的版本编译你的代码

    Adobe Flash Builder 4

    Using Adobe Flash Builder 4 instead of Flex Builder 3

    Adobe Flash Builder 4 is very similar to Flex Builder 3 and you should feel right at home from the beginning.

    使用Adobe Flash Builder 4.0 代替Flex bilder 3.0

    Adobe flash builder 4.0 于Flash builder 3.0 之间是非常相似的。在开始用4.0的时候就会感觉很熟悉。

    For a basic application the only migration(移民, 移植, 移往, 移动) step is to specify the theme. In Adobe Flash Builder 4 you have an option for "component set" where you can pick between MX+Spark (the default) or MX only. To specifically set your old applications to use the "old" halo theme simply add this compiler arguments to "Project Properties -> Flex Compiler":

    对于基础的应用功程序,唯一需要更改的地方时指定主题。 在Adobe FlASH BILDER 4中你有一个Componet set (组件设置)选项,你可以在MX+Spark(默认值)或者MX中选择一个。为来明确指定你的旧版本的应用程序使用旧版本的主题,仅仅需要简单的在"Project Properties -> Flex Compiler":中设置编译参数。

    -theme=${flexlib}/themes/Halo/halo.swcWhile it is possible to still use Flex Builder 3 if you add Flex 4 SDK support, our documentation assumes you are using Adobe Flash Builder 4. Similarly, while there are other IDEs that you may use, most of our documentation assumes you are using Flash Builder.

    当你添加来Flex 4.0 SDK却仍然用着Flex builder .3.0,我们的文档就会假设你正在私用Flash builder 4.0 。类似的,如果你还有可能使用其他的IDES,那么我们大所述的文档假设你使用Flash bilder。

    Upgrading your Flex API application code from 1.3 to 2.0

    These steps are to make your ArcGIS API 1.3 code work with ArcGIS API for Flex 2.0. See further below for how to upgrade your code in regards to(3:有关) general Flex 3 to Flex 4 conversion.(转变、改变)

    更新你的Flex api 应用程序代码从1.3到2.0

    这个步骤将会使用的ArcGIS API 1.3的代码用于ArcGIS API for Flex 2.0。一直向下面看如何更新的代码,这些代码与Flex 3.0和Flex 4.0之间的转变有关。

    Converting from 1.3 to 2.0 of the ArcGIS API for Flex.

    Still connecting to a 9.3 ArcGIS Server?

    If you are connecting to a 9.3* server, for example ArcGIS Online (until 10.0 is released), you might have to adjust your code.

    ArcGIS API for flex  1.3版本到2.0版本之间的改变。

    还能连接9.3的ArcGIS 服务器么?

    如果你连接一个9.3系列的版本,比如:ArcGIS在线服务(只到10版本才发布),你可能必须要调整你的代码。

    For Query and Geoprocessor, add useAMF="false" since AMF is now the default output format and older servers do not support AMF.

    For ArcGISImageServiceLayer, if you're not already specifying imageFormat, add imageFormat="png" since "jpgpng" is now the default output format and older servers do not support this image format.

    Change barriers(栅栏,关卡,检票口;障碍,隔阂;屏障) to pointBarriers.

    Change returnBarriers to returnPointBarriers.

    Change RouteSolveResult.barriers to RouteSolveResult.pointBarriers

    Project property changes

    Change the required flash player version to 10. Otherwise you might get the following error - "1046: Type was not found or was not a compile-time constant: Matrix3D"

    对于查询和地理处理,添加一个useAMF=“false”,因为AMF现在是默认的输出格式并且旧版本不支持AMF.

    对于ArcGISImageServiceLayer,如果你没有指定imageFormat,添加imageFormat=”Png”,因为,因为“jpgpng”显示是默认的输出格式,而旧的服务器不支持这种格式。。

    改变pointarriers的障碍。

    将returnBarriers改为returePointBarriers.

    将RouteSolveResult.barriers改变为RouteSolveResult.pointBarriers

    工程属性的改变

    将Flash player 播放器的版本升级到10.0。 否则你会得到入下所示的错误。error - "1046: Type was not found or was not a compile-time constant: Matrix3D"

    Change the SDK version to Flex 4. Otherwise you might get the following error - "1046: Type was not found or was not a compile-time constant: SolidColorStroke."将SDK版本升级到4.0。否则将会生成如下的错误。error - "1046: Type was not found or was not a compile-time constant: SolidColorStroke."

    Package Changes

    The easiest way is to just open your code in Flash Builder 4, setting the project to use the Flex 4 SDK and the 2.0 of the Flex API. Then fix each error as it shows up. One way to fix this is to go to the problem line by double-clicking an error such as "1046: Type was not found or was not a compile-time constant: FeatureSet.", then put the cursor at the end of "FeatureSet", press Ctrl-Space and Flash Builder will both add the missing one as well as organize all your import statements. Below is a more extensive list, but still the easiest way is probably to take advantage of the IDE and step through(2:逐步追踪) the errors.

    包裹的改变:

    对简单的方法是使用Flex builder 4打开你的代码,然后设置工程使用Flex 4.0的开发包和使用Flex API for Flex 2.0。 然后修改出现的每一个错误。一种更正这种错误的方式在错误栏里面双击错误行比如:"1046: Type was not found or was not a compile-time constant: FeatureSet.。然后将光标放置在FeatureSet的尾部,按下Ctrl-space,flash builder 将会添加那个丢失的变量,然后组织你的所有的重要声明语句。下面的是一个综合的列表,但是最简单的方法大概是利用IDE进行逐步追踪。

    The package "controls" has been renamed to components.

    The package "symbol" has been renamed to symbols to follow Flex 4 syntax.

    The package "toolbars" has been renamed to tools to clarify(澄清、阐明) that it contains tools (or functionality) and not any visual "toolbars".

    Supporting classes in the Layers package has moved into a subpackage(子包) com.esri.ags.layers.supportClasses.

    Supporting classes in the Tasks package has moved into a subpackage com.esri.ags.tasks.supportClasses, except for FeatureSet which is now in com.esri.ags.FeatureSet.

    Controls包已经被重新命名为组件包。

    Symbol包已经被重命名为symbols来使用Flex 4的语法。

    Toolbars包已经被重新命名为:tools,依次来澄清她包含着tools(或者功能)而不包含任何可视化的工具。

    在Layers包还有的supporting 类已经被移到到一个子包 com.esri.ags.layers.supportsClasses.

    Task 包含有的supporting类被移动到一个子包 com.esri.ags.task.supportClasses,其中除了featureSet 它现在在com.esri.ags.FeatureSet

    Supporting classes in the infoClasses and navigationClasses packages have moved into a common package com.esri.ags.components.supportClasses.

    All events are now in the Events package. This has affected InfoPlacementEvent and VEGeocodeEvent.

    Due to the package changes, you might have to add import statements for certain classes, for example the FeatureSet class which has moved from the com.esri.ags.tasks package to the com.esri.ags package. You will get a compile error, for example "1046: Type was not found or was not a compile-time constant: FeatureSet." One way to fix this is to go to the problem line, put the cursor at the end of "FeatureSet", press Ctrl-Space and Flash Builder will both add the missing one as well as organize all your import statements.

    在infoClasses中的Suporting classes类和NavigatjionClasses包已经移动到一个共同的包里面:com.esri.ags.compoments.supportsClasses;

    所有的事件现在都是事件包里面。这个已经影响到infoPlacementEvent和VEGeocodeEvent

    因为package的改变,你获取需要为一些类添加一些很重要的声明。比如:已经从com.esri.ags.tasks 包移动到com.esri.ags包的featureSet类。你可能会得到这样的错误,比如:1046: Type was not found or was not a compile-time constant: FeatureSet。 一个解决这个问题的办法是:找到这个问题出现的行,将光标放到featureSet,按下 ctrl-space,flashbuilder将会为你添加失去的包并为你整理所有的重要的声明。

    Name changes

    The Draw and Navigation "tools" have been renamed to DrawTool and NavigationTool.

    The arealengthsComplete event in GeometryService has been renamed to areasAndLengthsComplete.

    The arealengths property in GeometryServiceEvent has been renamed to areasAndLengthsComplete.

    名称的改变

    Draw 和Navigatjion  工具已经重新名称为“DrawTool”和”NavigationTool”

    GeometryService中的ArealengthsComplte事件已经被重新命名为:areasAndLengthsComplete

    GeometryServiceEvent中arealengths属性已经被重新命名为:arearsAndLengthsComplete。

    GPDateUtil has been renamed DateUtil since dates aren't specific(a.特定的;具体的 n.[ pl.]详情,细节) to just the Geoprocessor. For the same reason the class has moved from com.esri.ags.tasks to com.esri.ags.util.

    Geoprocessor.outputSpatialReference is the new name for the Geoprocessor.outputSpatialReference property. This makes it consistent with the other 'out' SpatialReference properties.

    GPDateUtil 已经被重新命名为:DateUtil,因为datas已经不在特的指向Geoprocessorw..同样的原因,DateUtil已经从com.esri.ags.tasks移动到com.esri.ags.util。

    Geoprocessor.outputSpatialReference是Geoprocessor.outputSpatialReference的新名称。 这是它和其他的”out” 空间参考属性保持一致。

    The getLayerDetails() method on ArcGISDynamicMapServiceLayer and ArcGISTiledMapServiceLayer have been renamed to getDetails(). They also have a new additional method called getAllDetails().

    All BufferParameters.UNIT_* constants have been renamed to GeometryService.UNIT_* since they have moved into the GeometryService class.

    Change BaseTask.sendURLVariable changed to BaseTask.sendURLVariables (i.e. pluralized).

    Routing now also supports line and polygon barriers. Thus the barriers property on RouteParameters and RouteSolveResult have been renamed pointBarriers, and the returnBarriers property on RouteParameters has been renamed returnPointBarriers.

    ArcGISDynamicMapServiceLayer和ArcGISTiledMapServiceLayer中的getLayerDetails()方法已经被重新命名为:getDetails()。 它还有一个新添加的方法,他叫:getAllDetails();

    所有的BufferParameters.UNIT_*常量已经被重命名为:GeometryService.UNIT_*,因为这些这些类已经被转移到GeometryServices 类。

    将BaseTask.sendURLVariable变为BaseTask.sendURLVariables(后面加上一个字母’s’);

    Routing 现在也支持线盒polygon障碍。 因此RouteParameters和RouteSolveResult中的barriers属性已经被重新名称为pointBarriers。RouteParameters 综中的returenBarriers属性已经被重新命名为returnPointBarriers。

    Constructor changes

    Constructor for PictureFillSymbol has changed - 'xoffset', 'yoffset' and 'angle' were added to the constructor after 'height'. For SimpleMarkerSymbol this means that they go in front of the 'outline' parameter. If you use the 'outline' parameter in your ActionScript constructor for SimpleMarkerSymbol, you will need to adjust your code.

    Other changes

    构造函数的改变

    PictureFillSymbol的构造函数中已经添加了- 'xoffset', 'yoffset' and 'angle',这些参数被添加参数”height”的后面。 对SimpleMarkerSymbol来说,这意味他们在'outline'参数的前面。 如果你在你SimpleMarkerSymbol的脚本构造函数中使用”outline”,你就需调整你的代码来适应这些改变。

    Replace the "features" property with "geometries" and make sure you update the value from an array of features to an array of geometries.

    The Extent.contains() method now takes any geometry, thus combining and expanding the functionality of the old contains(point) and containsExtent(extent) methods.

    The Navigation and Scalebar classes have been "sparkified" to take advantage of new Flex 4 functionality. You can now change the full skin parts instead of just some CSS settings. As part of this four classes (NavigationEvent, NavigationMinusButton, NavigationPlusButton and NavigationSlider) have been removed and replaced with three skins (NavigationSkin, NavigationZoomInButtonSkin and NavigationZoomOutButtonSkin).

    Since FeatureLayer supports selections, there are now less reason to do "selections" yourself using Extent.contains() or method.

    使用geometries取代features属性,并且确保你用features数字中的值来更新geometries数组中的值。

    Extent.contains() 方法现在使用有任何的geometry。因此和合并和扩展了旧版本的contains(point) and containsExtent(extent)方法的功能。

    Navigation 和 Scalebar类已经被sparkified(——)利用Flex 4.0的功能。现在你可以改变所有的皮肤部分而不是改变一些CSS设置。这四个类的部分内容已经被移除和被三个皮肤所取代。

    Inputs for GeometryService are now geometries instead of graphics.

    对于GeometryServices的输入,现在已经从graphics变为geometries了。

        //1.3:

        geometryService.project(graphics, new SpatialReference(32618));

        //2.0:

    geometryService.project([graphic.geometry], new SpatialReference(32618));GeometryServiceEvent now has a generic "results" property instead of arealengths, graphics, lengths and relations (depending on the specific method).

    In the case of a lengths operation, use Array(event.result) instead of event.lengths.

    在lengths的操作中,使用Array(event.result)代替event.lengths。

        //1.3:

        Alert.show( "Length of line:" + Number(event.lengths[0]/1000).toFixed(0) + " km." );

        // 2.0:

    Alert.show( "Length of line:" + Number((event.result as Array)[0] / 1000).toFixed(1) + " km.");

    In the response from a buffer operation, the GeometryServiceEvent now returns "result" instead of "graphics". In the case of a buffer operation, the actual geometries are now returned instead of an array of graphics.

        //1.3:

        for each ( var graphic:Graphic in event.graphics )

        // 2.0:

    for each ( var polygonGeometry:Polygon in event.result)The LayerEvent.TILES_UPDATED constant has been renamed to LayerEvent.UPDATE_END. We've also added a matching LayerEvent.UPDATE_START.

    //

    The AREA_LENGTHS_COMPLETE constant in GeometryServiceEvent has been renamed to AREAS_AND_LENGTHS_COMPLETE.

    The GRAPHIC_CLEAR constant has moved from the GraphicEvent to the GraphicsLayerEvent.

    The parameterValues property in ExecuteResult has been renamed to results. It still returns an array of ParameterValue.

    If using graphics with PictureMarkerSymbol and listening to events like mouse click, the target is now a custom sprite. In 1.3 the target was a graphic. See the Adobe help page on event propagation. AREA_LENGTHS_COMPLETE常量已经被重新命名为AREAS_AND_LENGTHS_COMPLETE.

    GeometryServiceEvent中的GRAPHIC_CLEAR的构造函数已经从GraphicEvent移动到GraphicsLayerEvent。

    ExecuteResult中的parameterValues属性已经改为results。她仍然返回一个ParameterValue。

    如果在PictureMarkerSymbol中使用graphics并且侦听事件比如:鼠标单击,那个目标现在已经是一个自定义的sprite。 在1.3中target是一个.Graphic。请查看Adobe的帮助文档。

    Removed, replaced or otherwise changed:

    GraphicsLayer.SymbolFunction functionality has been replaced with renderers. You will need to re-write any SymbolFunction code.

    The graphicClear event in the GraphicsLayer class has been renamed to graphicsClear (note the extra "s") to clarify(vt.澄清,阐明) that it fires when all graphics are cleared as opposed to graphicRemove that fires when a single graphic is removed.

    Upgrading your Adobe Flex 3 SDK code to Flex 4 SDK

    Open your existing application and make sure the SDK version is set to Flex 4 (in either Flex Builder or Flash Builder). Try to compile it and you might get some errors, or it might just work. Then read at least the Adobe Flex 4 Features and Migration Guide

    移动,代替和其他的改变:

    GraphicsLayer的SymbolFunction功能已经被renderers取代。你需要重写任何SymbolFunction功能的代码。

    GraphicsLayer类中的graphicClear事件已经被重命名为graphicsClear(注意另外的一个”s”)来澄清和阐明当所有的graphics被清除后调用这个事件,类似于当一个单独的graphic被清除后调用graphicRemove事件。

    更新你的Adobe Flex 3.0开发包代码到Flex 4.0 开发包。

    打开你已经存在的应用程序,确保SDK的版本被设置为Flex 4.0(不管是Flex builder或者Flash Builder).。试着去编译他们,你可能会得到几个错误,或者可能能够使用正常运行。 然后至少阅读Adobe Flex 4 要素和迁移向导。

    Adobe's Flex Developer Center is a great place to learn more about Flex in general. Here's a few links that might be useful in your migration:

    一般来说ADOBE的flex 开发者中心是一个学习Flex知识的好地方。这里有些链接可能在你的转移过程中是有用的。

    //下面的是一些学习资料的链接

    What's new in Flex 4

    What's New in Flash Builder 4 (70+ new features)

    Adobe Flex 4 Features and Migration Guide

    //

    Moving existing Flex projects from Flex Builder 3 to Flash Builder 4

    Step 1. Making it work with Flex 4 SDK

    Replace Application.application (as in Application.application.url) with FlexGlobals.topLevelApplication (and FlexGlobals.topLevelApplication.url).

    Step 2 (optional). Switch from halo (mx) components to spark components

    Replace mx:Application with s:Application, and set the namespaces to:

    xmlns:fx="http://ns.adobe.com/mxml/2009"

    xmlns:s="library://ns.adobe.com/flex/spark"

    xmlns:mx="library://ns.adobe.com/flex/mx"

    xmlns:esri="http://www.esri.com/2008/ags"Put any "declarations" inside fx:Declarations.

    将一个已经存在的Flex工程从Flex Builder 3移动到Flash builder 4中。

    第一步:确保它使用的是Flex 4.0的SDK。

    使用FlexGlobals.topLevelApplication取代e Application.application

    第二步(可选):从mx组件转换为spark 组件。

    用s:Application取代mx:Application,并设置下面的命名空间。

    xmlns:fx="http://ns.adobe.com/mxml/2009"

    xmlns:s="library://ns.adobe.com/flex/spark"

    xmlns:mx="library://ns.adobe.com/flex/mx"

    xmlns:esri="http://www.esri.com/2008/ags"Put any "declarations" inside fx:Declarations.

    Replace mx:style with fx:style.

    Replace mx:ArrayCollection with s:ArrayCollection.

    Replace mx:Number with fx:Number.

    Consider replacing mx:Text with s:Label.

    Default layout is now absolute, to keep it as "vertical", add:

    使用fx:style.取代mx:style。

    使用s:ArrayCollection.取代mx:ArrayCollection。

    使用fx:Number取代fx:Number

    默认的layout现在是absolute,为了保持它为vertical,添加下面的代码

    <s:layout>

        <s:VerticalLayout/>

    </s:layout>

    Remove any layout="absolute" since it is now the default.

    删除所有的layout="absolute",因为现在他就是默认值。

    Step 3 (optional). Taking advantage of new features in Flex 4 SDK

    Read up on Flex 4 and learn more about Spark components, new layouts, skinning and styling possibilities.

    第三步:使用Flex4.0中的新的Featrues。

    查看Flex 4,学习更多,包括:t Spark components, new layouts, skinning and styling possibilities

  • 相关阅读:
    kafka 0.8.x producer Example(scala)
    Google V8扩展利器发布:v8-native-binding-generator
    beyond compare秘钥被禁
    STL算法之find
    十条nmap常用的扫描命令
    cgdb UTF-8乱码
    OpenWrt笔记
    openwrt hotplug
    git常用操作
    c99标准的restrict关键字
  • 原文地址:https://www.cnblogs.com/xingchen/p/1802993.html
Copyright © 2011-2022 走看看