Flex: Use 3.5.0 compatibility mode with 4.6.0 SDK

I'm trying to evaluate using IntelliJ instead of Flash Builder as our Flex IDE. I have project with 4 modules where one is the actual main SWF app with the UI, and the others are SWC libraries containing business logic, styles, and assets.

Due to the history of this project we need to build it using the 4.6.0 SDK, with the "Use Flex 3 compatibility mode" enabled. This is a checkbox in the Flex Compiler settings in Flash Builder. How can I achieve the same setup using IntelliJ? Right now, I get errors such as these when I compile the main project: The style 'backgroundImage' is only supported by type 'mx.containers.Box' with the theme(s) 'halo'

Also, one of the other project always fail to build with a "Java heap space" error, i.e. running out of memory. I've tried bumping up "compiler heap size" to 1,400 MB to no avail. Any suggestions? I notice that the compiler runs a 32-bit java process. Is there a way to run it 64-bit mode?

Thanks!!

4 comments

Due to the history of this project we need to build it using the 4.6.0 SDK, with the "Use Flex 3 compatibility mode" enabled. This is a checkbox in the Flex Compiler settings in Flash Builder. How can I achieve the same setup using IntelliJ? Right now, I get errors such as these when I compile the main project: The style 'backgroundImage' is only supported by type 'mx.containers.Box' with the theme(s) 'halo'

If you use only MX components and not using Spark components, you need to select 'MX only' at Project Structure | Modules | [your module] | [your build configuration subnode] | Dependencies tab | Component set. After that you'll have halo.swc as default theme at Compiler Options tab (Styles and Themes | Theme node). You can also change theme manually without changing component set if you need.
Second thing you probably need to do is add -compatibility-version=3.5 as Additional compiler options at Compiler Options tab.

Also, one of the other project always fail to build with a "Java heap space" error, i.e. running out of memory. I've tried bumping up "compiler heap size" to 1,400 MB to no avail. Any suggestions?

Settings | Compiler | Compiler process heap size (Mbytes) can be set to some very small value for Flash/Flex projects, because Flex compilation is performed in a separate process. You can control Flex Compiler heap size at Settings | Compiler | Flex Compiler | Compiler heap size. Don't make the heap more than really required, it may cause failures as well as small heap size.
Other option is to switch to mxmlc/compc instead of Built-in compiler shell at Settings | Compiler | Flex Compiler. Or you may try bothe switching to mxmlc/compc and increasing heap, but again, try to set the heap to minimal value that works.

I notice that the compiler runs a 32-bit java process. Is there a way to run it 64-bit mode?

I remember there are some performance and other problems with Flex Compiler in 64-bit mode. You can try at your own risk: you need to specify java.home property in the [Flex SDK]/bin/jvm.config file, set it to some 64-bit JVM.

0

If you use only MX components and not using Spark components, you need to select 'MX only' at Project Structure | Modules | [your module] | [your build configuration subnode] | Dependencies tab | Component set. After that you'll have halo.swc as default theme at Compiler Options tab (Styles and Themes | Theme node). You can also change theme manually without changing component set if you need.
Second thing you probably need to do is add -compatibility-version=3.5 as Additional compiler options at Compiler Options tab.


Excellent, that fixed it! :)

Settings | Compiler | Compiler process heap size (Mbytes) can be set to some very small value for Flash/Flex projects, because Flex compilation is performed in a separate process. You can control Flex Compiler heap size at Settings | Compiler | Flex Compiler | Compiler heap size. Don't make the heap more than really required, it may cause failures as well as small heap size.
Other option is to switch to mxmlc/compc instead of Built-in compiler shell at Settings | Compiler | Flex Compiler. Or you may try bothe switching to mxmlc/compc and increasing heap, but again, try to set the heap to minimal value that works.


Thanks for clarifying the options! I haven't been able to get any working builds in 32-bit mode. When switching to a 64-bit JVM (thanks for the help with that!), it actually worked, after bumping up the heap space up to 2 GB. Watching Task Manager, the java process hit 1.7 GB before compilation completed. This is the assets project, which has about 1,500 files (icons and images etc), or 28 MB in total. The final output is just 9 MB. Any ideas on why it would take such an incredible amount of memory, and what I can do to reduce it?

Thanks a ton!!

0

Update: All of a sudden I started running out of heap space again. After upping it to 4 GB it completed successfully after hitting 2.5 GB of memory.

0

I can't say for the Flex compiler, why it requires such a huge heap. Probably it takes 2 times more heap when in 64-bit mode. But if 32-bit mode doesn't work then seems you have no choice. For such case separate mxmlc/compc processes would be better than one Build-in compiler shell (Settings | Compiler | Flex Compiler).
Consider splittins huge assets SWC into 2 or more.

0

Please sign in to leave a comment.