Flex 3相当于'<fx:declarations>'?</fx:declarations>

时间:2011-05-26 02:10:39

标签: flex actionscript-3 flex3 flex4

我正在尝试将Flex 4项目向后迁移到Flex 3,我需要在MXML中移动<fx:Declarations>块中映射的内容。 Flex 3有类似的东西吗?自从我完成Flex 3以来已经有一段时间了。

4 个答案:

答案 0 :(得分:7)

Flex 3中没有等效内容。您可以将其他组件声明。 difference in Flex 4使视觉和非视觉项目(包括效果,验证器,格式化程序,数据声明和RPC类)之间的分离更加清晰。

例如,在Flex 4中,您可以这样做:

<?xml version="1.0" encoding="utf-8"?>
<s: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">

    <fx:Declarations>
        <fx:String>Hello, world!</fx:String>
    </fx:Declarations>

    <!-- Component defintions -->

</s:Application>

但是在Flex 3中,你会这样做:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:String>blah</mx:String>

    <!-- Component defintions -->

</mx:Application>

但是,您可以分别在Flex 3和4中的<mx:Script><fx:Script>标记中定义变量和其他任何声明(可视或不可视)。

如果您坚持其他更改,请在Adobe网站上搜索migrating from flex 3 to flex 4,了解您可能需要做出的其他更改。

答案 1 :(得分:1)

无需单独定义,当然不支持

 <fx:Declarations>

 </fx:Declarations>
Flex 3中的

在声明标记中,您可以定义非可视标记,例如效果,服务标记等。但Flex 3 SDK中没有针对非可视标记的确切标记。

答案 2 :(得分:1)

从根应用程序标记开始。在flex3中不需要<fx:declaration>只需在根标记内分配组件

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    layout="vertical"
    backgroundColor="#000000"
    backgroundGradientAlphas="[0.0,0.0]"
    paddingTop="30"
    applicationComplete="init()"
    preloader="com.nickkuh.preload.Preloader"
    viewSourceURL="srcview/index.html">

    <mx:Script>
        <![CDATA[
            /*script area*/
        ]]>
    </mx:Script>

    <!-- your controls can define here -->

    <mx:Panel id="appPanel" visible="false" width="600" height="500" showEffect="{fadeIn}" />

</mx:Application>

答案 3 :(得分:0)

没有。旧版本的框架将假设任何非可视元素都是“减速”。添加了减速标签,以便可以在火花皮中使用MXML定义组件工厂。

修改

但如果我没记错的话,他们确实需要进入顶级MXML标签。我可能错了......