0
votes

I'm currently working on an Adobe Flex Air Project, which was created with Flex 3.6! But now it should become an App for IPad, but Flash Builder can only export projects as App since Flex 4.6. So I'm trying to convert the project from Flex 3.6 to 4.6, what should be easy to do, I guess, but there are some problems with libraries and/or namespaces, which confuse me. This is how my Main-mxml starts:

<s:Application xmlns:mx="http://ns.adobe.com/mxml/2009" 
           xmlns:mx="library://ns.adobe.com/flex/mx" 
           xmlns:s="library://ns.adobe.com/flex/spark"
           xmlns:MyComp="*"
           xmlns:local="*"
           xmlns:srv="generated.webservices.*"
           width="1366"
           applicationComplete="init()"
           backgroundGradientColors="[0xffffff,0xffffff]"
           borderColor="#ffffff"
           color="#eaeaea"
           fontSize="14"
           horizontalScrollPolicy="off"
           layout="absolute"
           paddingBottom="0"
           paddingLeft="0"
           paddingRight="0"
           paddingTop="0"
           verticalScrollPolicy="off">

But I get the error:

`Attribute "mx" bound to namespace "http://www.w3.org/2000/xmlns/" was already specified for element "s:Application".`

But if I remove the line

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

then of course I can't use e.g. mx:VBox any more and would have to refactor the whole project.

I tried some test examples using Flex 4.6, e.g.

<?xml version="1.0"?>
<!-- containers\layouts\BoxSimple.mxml -->
<s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    xmlns:s="library://ns.adobe.com/flex/spark">

    <mx:Box direction="vertical" 
            borderStyle="solid" 
            paddingTop="10" 
            paddingBottom="10" 
            paddingLeft="10" 
            paddingRight="10">

        <mx:Button id="fname" label="Button 1"/>
        <mx:Button id="lname" label="Button 2"/>
        <mx:Button id="addr1" label="Button 3"/>
        <mx:ComboBox id="state">
            <mx:ArrayList>
                <fx:String>ComboBox 1</fx:String>
            </mx:ArrayList>
        </mx:ComboBox>
    </mx:Box>
</s:Application>

But here I get the error

    `"Could not resolve <mx:Button> to a component implementation." `and more like this.

Now my question(s): 1. It's possible to use all three namespaces

 `(xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    xmlns:s="library://ns.adobe.com/flex/spark")`

Right? I saw this on several examples on the internet so I think it must work.

  1. Do I have to reference/add external libraries to use Flex 4.6 with these 3 namespaces?
  2. Is there an easy general way for migrating from Flex 3.6 to 4.6? Is it at all necessary to make changes or must it work in 4.6, even though developed in 3.6?

Besides, I'm relatively new to Flex, though it's not difficult I think.

Thanks in advance

Regards,

Max B

2
The first xmlns:mx should be xmlns:fx that should fix that namespace issue.Justin Mclean
Migration Issue : stackoverflow.com/questions/39224850/… Can someone please help with above link ?jigar

2 Answers

2
votes

Max - to answer your question specifically it is absolutely possible to use MX components within Flex 4 apps. Your example seems to work fine with a regular flex 4.6 project. You might need to ensure you have the right library path settings.

enter image description here

1
votes

Flex isn't difficult, but migrating between major verions can be a pain in the ass and may require a more seasoned developer. The fact is you have to know both frameworks, what are their differences and how you can fix those differences.
So Is there an easy general way for migrating? Well, ... no (or yes if you're willing to compromise, more on that later).

As for the namespaces: you can use all three of them together in one application and there's nothing special you have to do for that. That is, if you're building a traditional web app. If you're building a mobile app, some other framework libraries are used which do not inculde the components from the mx age. The reason is that Spark components or much more efficient and mobile devices just aren't as powerful as desktops yet.
Which means you'll have to convert your entire application to the Spark namespace. If your views haven't completely been separated from the business logic, you might as well rewrite it from scratch.

You can force the compiler to include the mx libraries however, even when compiling for mobile. But this will come at a performance cost.

That said, all I've said until now was on a technical level. From a UX point of view you can not expect an application that was designed for a big screen to be pleasant to use on a small one. In most of the cases these 'simple' conversions are complete failures.