flex 4.10 : String not defined

Hello
I use IntelliJ12.1.4 ultimate on MacOsX 10.8.5

I have a very simple flex web project that works perfectly with flex sdk 4.6
I just downloaded flex 4.10.0 from apache site and added into my sdks. When swiching to 4.10 I have 2 problems :

1) the list of "Target Player" for the project is empty (i have to add -target-player=10 in compiler options
2) IntelliJ considers String as an unresolved type in lines like :
var reqtype:String="";

I tried to build a new flex project form scratch. It generates a simple mxml with a click event on the button, and click is not recognized by intellij (Attribute click is not allowed here). "String" type is not resolved.

Is there anything wrong in the 4.10 sdk ? Or maybe it is not compatible with intelliJ 12 ?
Thanks for any help.

6 comments

Hi,
You need to install Apache Flex SDK using installer (http://flex.apache.org/installer.html), otherwize it doesn't contain some required 3rd party components like playerglobal.swc where String class is defined.
Don't forget to remove -target-player option and other hacks that you tried when you install the SDK properly.

0

Hello
Thanks a lot for your answer. It worked all right. I found it really strange from apache to not include all swc in the tar.gz... simplicity is gone...

I have 2 questions about this new sdk :

1) I cannot find the way to add other target players (I need to target player 10), the flex installer does not seem to allow multiple target players. Is there any way to do that, or shall I keep my -target-player=10 option ?

2) in a very simple project, the resulting swf is about 6 times bigger than with flex 4.6 (80kb becomes 450kb) both projects are without debug information. Is it normal ? I tried to change the linkage option but it does not change the resulting size. I cannot continue with this sdk if there is no way to reduce the swf because the real application has already 1Mb on flex 4.6 , it would be too large for a web application.

Thanks a lot.

0
I found it really strange from apache to not include all swc in the tar.gz...

That's licence issues. Apache can't distribute some 3rd party components other than via installer where you accept all required licenses.

add other target players

You need to do the following:

  • download corresponding version of the playerglobal.swc from http://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html#playerglobal
  • place playerglobal.swc in the corresponding folder in the SDK: [Flex SDK]/frameworks/libs/player/XX.X. In your case XX.X equal to 10.2 or 10.3 (as far as I know minimal version supported by the Flex SDK is 10.2)
  • in IntelliJ IDEA at Project Structure | SDKs delete configured SDK and add it again. You'll see that Classes tab now contain several versions of playerglobal.swc file - that's ok
  • now you'll be able to select another target player at at Project Structure | Modules | [your module] | [your build configuration subnode] | Dependencies tab

the resulting swf is about 6 times bigger than with flex 4.6

Default framework linkage for Adobe Flex SDK is 'Runtime-shared library', but for Apache Flex SDK it is 'Merged into code'. That's because Apache Flex RSLs are not signed so they are not used across domains. Well, it is still possible to set linkage type to RSL (Dependencies tab of the corresponding build configuration in IntelliJ IDEA), but there's a bug in Flex SDK 4.10, so to make it work see workaround here: http://youtrack.jetbrains.com/issue/IDEA-111740

0

Thanks a lot Alexander,
For information, adding the playerglobal.swc and reloading sdk was not enough, I had to add the new swc manually in the sdk, but it worked.

I changed the flex-config.xml and the final app size got back to 80kb (in runtime linkage). But unfortunately the web application does not work anymore. There is an error shown in the bottom of the swf app when in debug mode :

Error #2032: Stream Error. URL: http://localhost:8000/framework_4.10.0.20130801.swf

I suppose that the player tries to download all those libraries separately (while 4.6 didn't need them even in runtime linkage). Well this is useless, it means that the full swf/swc to download is 2,7Mb (i did the test of adding all required swc), it's even worse than merge linkage !
Does this mean that flex 4.6 needs swc libraries that are already in the player  ? I don't think so and cannot explain this difference.

I remember when switching from FlexBuilder to IntelliJ, 2 years ago, I found it wonderful that all thoses frameworks swc copied by Eclipse were no more necessary thanks to InteillJ . It seems that they are back.
If you have some workaround, I'd be glad to hear.

Thanks a lot.

0
reloading sdk was not enough, I had to add the new swc manually in the sdk

Deleting/adding SDK at Project Structure | SDKs is exactly to pick the newly added playerglobal.swc. Probably IntelliJ didn't refresh its internal file system when you were doing it first time. Ok, since it is ok now, forget it.

I suppose that the player tries to download all those libraries separately

Yes, as I mentioned, Apache Flex RSLs are not signed so they are not used across domains. With Adobe Flex 4.6 all RSLs were downloaded once from Adobe site and kept forever in Flash Player cache, but with Apache Flex SDK they will be downloaded separately for each domain including localhost. That's why default linkage is Merged. Unfortunately there's no way for the Apache Flex team to force Adobe to sign their RSLs.

0

I understand,
Thanks a lot for your help.

0

Please sign in to leave a comment.