开发者

Flex 3 equivalent of '<fx:Declarations>'?

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.


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.


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.


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>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜