简体   繁体   English

使用Flex4 SDK进行编译

[英]Compiling with Flex4 SDK

I'm trying to compile an existing Flex3 project with the Flex4 SDK. 我正在尝试使用Flex4 SDK编译现有的Flex3项目。 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. 生成的文件与我原来的Flex3编译的.swf文件大致相同。 Playing the resulting .swf file in the Flash Player also gives the following errors: 在Flash Player中播放生成的.swf文件也会出现以下错误:

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. 如果我将编译器属性static-link-runtime-shared-libraries为true,那么错误就会消失,一切都很好。 However, the size of the resulting .SWF is a couple of 100K's bigger. 但是,由此产生的.SWF的大小是几个100K的大。 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. 我并不完全理解运行时共享库​​的概念,但似乎通过将它们静态链接的选项设置为true,这些库包含在.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). 但是,我喜欢将它们从.swf中排除,并且只在运行时加载所需的库,因为我的项目似乎与Flex3有关(顺便说一句,我不知道)。

If I understand correctly, playerglobal.swc should hold all the necessary code for the external libraries that my .swf has to load. 如果我理解正确的话,playerglobal.swc应该包含我的.swf必须加载的外部库的所有必要代码。 Do Flex4 compiled files need more libraries? Flex4编译的文件需要更多的库吗? Should I do something with the factoryClass in the Frame metadata tag? 我应该对Frame元数据标签中的factoryClass做些什么吗?

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? 我想我的问题归结为:我如何编译一个与之前的Flex3编译的.swf大小相同的Flex4 .swf?

您必须将[Frame(factoryClass="path.to.your.preloader")]到主类(您在编译器选项中设置的类)。

Flex3 did not use rsls by default but you could enable them. Flex3默认情况下不使用rsls,但您可以启用它们。 Flex4 rsls are enabled by default, see: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7add.html 默认情况下启用Flex4 rsls,请参阅: 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. 你可以创建自己的rsl,但它主要是adobe提供的那些意味着有所不同:由于'everybody'将使用它们,你需要的库有可能已经存在于用户的系统上,从而加快应用程序的下载时间。

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) playerglobal.swc从未包含任何flex框架类,其中大部分都在flex.swc和framework.swc中(标准的flex 3项目还包括rpc.swc和utilities.swc - 我没有检查但是这些可能包含一些弹性部件以及)

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 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. 这是一篇非常好的文章,概述了迁移的不同可能性,具体取决于您要使用的Flex4内容的数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM