Compiling with Flex4 SDK

心不动则不痛 提交于 2019-12-21 02:57:11

问题


I'm trying to compile an existing Flex3 project with the Flex4 SDK. I'm getting this error:

Warning: This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option.

The resulting file is roughly the same as my old Flex3 compiled .swf file. Playing the resulting .swf file in the Flash Player also gives the following errors:

An Actionscript error ocurred: VerifyError: Error #1014: Class spark.core::SpriteVisualElement could not be found

If I set the compiler attribute static-link-runtime-shared-libraries to true, then the error disappears and all is well. However, the size of the resulting .SWF is a couple of 100K's bigger. And that's not what I want.

I don't fully understand the concept of runtime shared libraries, but it seems that with the option to statically link them set to true, the libraries are included in the .swf. However, I like to exclude them from the .swf and only load the needed library at runtime, as my project seemed to do with Flex3 (I didn't know that by the way).

If I understand correctly, playerglobal.swc should hold all the necessary code for the external libraries that my .swf has to load. Do Flex4 compiled files need more libraries? Should I do something with the factoryClass in the Frame metadata tag?

I think my question boils down to this: How do I compile a Flex4 .swf that is the same size as my previous Flex3 compiled .swf?


回答1:


You have to add [Frame(factoryClass="path.to.your.preloader")] to the main class (the one you set in the compiler options).




回答2:


Flex3 did not use rsls by default but you could enable them. Flex4 rsls are enabled by default, see: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7add.html

The concept of runtime shared libraries is: splitting of a part of your application that is (re)used by other apps as well, thereby only requiring the user to download it once. This won't save anything on the first download but will save on later downloads. You could possibly make your own rsl, but it's mostly the ones provided by adobe that are meant to make the difference: Since 'everybody' will use them there will be a bit chance the library you need is already present on the user's system, thereby speeding up the download-time of your app.

playerglobal.swc never contained any flex framework classes, most of them are in flex.swc and framework.swc (a standard flex 3 project also includes rpc.swc and utilities.swc - I didn't check but these probably contain some flex parts as well)




回答3:


Looks like you might have project migration problems. You might want to read up on the process on:

http://www.adobe.com/devnet/flex/articles/flexbuilder3_to_flashbuilder4.html

It's a really good article with overview of different possibilities for migration, depending on the amount of Flex4 stuff you want to use.



来源:https://stackoverflow.com/questions/3079112/compiling-with-flex4-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!