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?
You have to add [Frame(factoryClass="path.to.your.preloader")] to the main class (the one you set in the compiler options).
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)
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.
Related
How to use RSL(Runtime shared library) in flex ?
how can decrease loading time of swf using rsl?
please give answer
The SDK default setting of the project is RSL.
check here Goto Project->Properties choose the Library path from the tab where you can see the framework linkage.
The thing is It is one of the way to reduce the size of the application and the library files are downloaded and saved to cache file in browsers. so when you run the application again, the library files are taken from the browser cache.so the loading makes faster than the first time.It continues until the cache is cleared from the browser. for more information refer here.
can any one help me that where is the SWC or run time library for the flex controls exist in the system?
Or can we provide our own library by using the controls in the dir
C:\Program Files\Adobe\flex_sdk_3.2\frameworks\projects\framework\src\mx
It is not very obvious what are you trying to ask but I'll try to guess :)
So the SWC with Flex controls is located here {Flex.SDK.root}/frameworks/libs/framework.swc and the corresponding RSLs are located here {Flex.SDK.root}/frameworks/rsls.
What about providing your own library to replace Flex controls I think it is not the right way. The best practice is not modify Flex SDK installation to have possibility to build your project on every computer with different environments (on a different developers computers or on client site).
And you should take in mind there are 4 standard ways to use code in Flash application:
Compile your code into SWF.
Use Runtime Shared Library aka RSL (which is SWF too).
Use SWZ which is signed and can be cached by Flash Player.
Use modules which are SWFs.
None of these ways doesn't suppose using Flex SDK in runtime. Flex SDK is being used only in process of building of your application.
So the best way to use some custom controls is to build them with your application using one of the ways I described above (excluding SWZ's which can be produced only by Adobe).
Just leave Flex SDK installation without changes and place classes/SWCs with custom controls in your project's classpath.
Hope this helps.
When i make a release build the folder is populated with a number of swfs. Are all these swfs necessary? Is there a option to generate one swf?
Thanks in advance
EDIT
The files I see are:
framework_4.5.0.18623.swf
osmf_1.0.0.16316.swf
rpc_4.5.0.18623.swf
spark_4.5.0.18623.swf
sparkskins_4.5.0.18623.swf
textLayout_2.0.0.200.swf
playerProductInstall.swf
I assume you're using Flash Builder 4 and/or Flex 4 SDK and see a bunch of SWZ files is that correct? These are framework files which can be cached by the player across multiple domains. Through this caching, the download size of your app is smaller because all these dependencies are left out.
If you want to combine everything to one SWF, in Flash Builder 4 open up the project properties and choose Flex build Path. You'll see a framework linkage option. Change it from "Runtime shared library" to "Merged into code. This default value was changed when moving from Flex 3 to Flex 4.
I'm not sure how to do it via command line, but I'm sure similar options exist.
Be warned, though, this will make your SWF bigger and you won't take advantage of the framework caching options.
Update:
The files you're seeing are definitely Flex Framework files. The reason they are SWFs instead of SWZs is because you are using a prerelease SDK (4.5 ) and the SWZs are not available for caching yet.
Here's what I found:
With Flex closed navigate to:
{Your Flex installation}\sdks\4.1.0\frameworks\flex-config.xml (where 4.1.0 is your latest version)
open flex-config.xml and scroll down until you see 6 items for "runtime-shared-library-path" it will look similar to:
<runtime-shared-library-path>
<path-element>libs/textLayout.swc</path-element>
<rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/1.1.0.604/textLayout_1.1.0.604.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
<rsl-url>textLayout_1.1.0.604.swz</rsl-url>
<policy-file-url></policy-file-url>
</runtime-shared-library-path>
Edit the "rsl-url" tag to place the swz file where you'd like:
<rsl-url>myrsl/textLayout_1.1.0.604.swz</rsl-url>
Do this for the remaining "runtime-shared-library-path" tags. Save it and launch Flex, your release build should now dump those .swz files into a folder called myrsl (or whatever you named it)
I have modifyed XMLEncoder class from Flex SDK (XMLEncoder.as)
After it I run my project but I don't see any changes...
What should I do to realy modify project's behaviour?
Thanks!!!
It's not usually recommended but what you are trying to do is Monkey Patching. You can just copy your modified source file into your project and then you application's XMLEncoder will overwrite the one used in Flex (because of how the Flex linker works). This doesn't work with the framework RSLs though.
If you don't see changes, this means sources aren't used - swc is used instead. To use modified sources, recreate folder structure for the class you modified and put source there. You may see a lot of errors (most of the time because include directive), this means you need to copy files needed to satisfy dependencies.
Maybe this is not the right way, but sometimes it's the only option to fix broken Flex class, so professional Flex developer masters it sooner or later :)
I wanted an animation to dispatch custom events as it cycled. It became apparent that not even trace() was running. After some searching, I found the following at Adobe:
http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html
"If the SWF file contains any ActionScript code, Flex prints a warning during compilation and then strips out the ActionScript from the embed symbol. This means that you can only embed the symbol itself."
I also found a work-around by Grant Skinner at:
http://gskinner.com/blog/archives/2007/03/using_flash_sym.html
So, I can proceed, but I'm still wondering. Why does mxmlc strip ActionScript from Flash compiled resources when embedding their symbols into Flex apps using metatags?
Sorry for the very late response, but since I wrote that code, I can answer. :-)
Basically, there are two answers.
For old SWF assets that contain AS2 bytecode, it was far too much work to try to convert the bytecode to AS3. I'm assuming this isn't theuse case you care about anyway.
For SWF assets linked to AS3 bytecode, the basic problem is that there is no dependency information any more, so when we clone the asset, we have no idea what else we would need to pull. Because Flash can export a SWC, I decided that this was a far more robust workflow for getting assets with code from Flash to Flex. (Take a peek inside a SWC file, and you'll see an XML file that describes the dependencies used by the linker.)
It's probably a performance issue. To load a swf resource without stripping it, load it dynamically using SWFLoader or Loader instead of embedding it.