Flex 3 equivalent of ''?

2019-07-17 09:12发布

I'm trying to migrate a Flex 4 project backwards to Flex 3, and I need to move stuff mapped in a <fx:Declarations> block in MXML. Does Flex 3 have something similar to this? It's been a while since I've done Flex 3.

4条回答
Emotional °昔
2楼-- · 2019-07-17 09:19

Start with root application tag.There is no need for <fx:declaration> in flex3 just assign components inside the root tag

<?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楼-- · 2019-07-17 09:33

There is no need to define separately and off course not supported

 <fx:Declarations>

 </fx:Declarations>

in the Flex 3.

In the declaration tag you define non visual tags like Effects, services tags etc.But there is no exact tag in Flex 3 SDK for non visual tags.

查看更多
霸刀☆藐视天下
4楼-- · 2019-07-17 09:38

There is none. The older version of the framework will assume any non-visual element is a "deceleration". The decelerations tag was added so that component factories could be defined using MXML in a spark skin.

edit

But if I remember correctly, they do need to go in the top level MXML tag. I could be wrong though...

查看更多
Deceive 欺骗
5楼-- · 2019-07-17 09:41

There is no equivalent in Flex 3. You can declare things alongside your other components. The difference in Flex 4 makes the separation between visual and non-visual items (including things like effects, validators, formatters, data declarations, and RPC classes) clearer.

For example, in Flex 4 you would do this:

<?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>

but in Flex 3, you would do this:

<?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>

You can, however, define your variables and whatever other declarations (visual or not) within the <mx:Script> or <fx:Script> tag in Flex 3 and 4 respectively.

If you're stuck on other changes, search Adobe's website about migrating from flex 3 to flex 4 to see what other changes you may have to make.

查看更多
登录 后发表回答