Flash Builder 4 Release Build multiple files - apache-flex

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)

Related

Prevent FlashBuilder from building all my assets

One annoying thing here..
My project contains lots of assets (a couple GB). They never change. At least not when I'm working on the main MXML code. Is there a way to prevent FlashBuilder to rebuild (delete, then copy) all my assets almost everytime I save or hit debug?
All I need to build is the main MXML file which is edited..
Thanks guys! =)
Move the unchanging assets to a separate library file. Link back to them from the 'project' 'properties'.
EDIT:
Library files can either be compile-time linked or run-time.
For details:
- Flex 4.7
- Flex 3

Importing flex compiled swf into a flash file

I've built a form in Flex.
When I run the flex project, I get a html file with some js, css and swf files (NOT A SINGLE FILE), swz files.
When I run the main swf file alone, many things are working perfectly except at places where it needs to send a HTTPService request.
When I use the html file, all works fine.
Now I want to do the following.
Import this form made in flex into a flash site (actionscript 3)
This form has various ViewStacks, where the user will be travelling through these. I want to reload the form back to its initial stage when the user wants to fill the fields again.
Can there be any request sent to the Flash Site from this FORM, regarding the form submission success ?
Can I compile the Flex Project to one single swf file, so that I can use this swf file without any Browser?
Can I convert the webpage application Flex Project to an Adobe AIR application ?
Details:
I used flash builder 4... and flex 3 coding as in
<mx:Application/>
mx namespace is "http://www.adobe.com/2006/mxml"
and no "s", or "fx" namespaces defined.
I'm sorry I can't answer all your questions, but I can answer:
Import this form made in flex into a flash site (actionscript 3)
I don't see why not, although I never did that myself; typically it's the other way around as Flex swf are really more applications than regular flash swf typically are.
Can I compile the Flex Project to one single swf file, so that I can
use this swf file without any Browser?
Yes you can:
With Flash Builder, go to Project->Properties->Flex Build Path, and
change Framework Linkage to Merge Into Code
When invoking the mxmlc compiler directly, use the option -static-link-runtime-shared-libraries=true
Can I convert the webpage application Flex Project to an Adobe AIR
application ?
Yes you can by right-clicking your project in the Package Explorer window, and under Add/Change Project Type, you get make your project an Air application.

where is the flex library file exist swc

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.

Compiling with Flex4 SDK

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.

Can Flash Builder 4 Premium compile Flex Builder 3 Pro project?

That's about it. Oh, and I don't want to convert the Flex Builder Project making it incompatible with Flex Builder 3 Pro.
Yes! Here is an article and video that shows how to use the Flex 3 SDK in Flash Builder 4.
Yes, you can compile the project with Flash Builder 4. ISTR it either silently updated my project settings or I might have converted the project.
In any case, if you are trying to simultaneously use Flex Builder 3 and Flash Builder 4 you should note that at least one of the internal eclipse & FB project settings files (.actionScriptProperties, .flexProperties & .project) changed format between FB3 and FB4 - I can't remember exactly which ones changed off the top of my head.
This will affect your development workflow.
I have previously used Flash Builder 4 on a project whilst the rest of the team was using Flex Builder 3. Whenever they updated their project I had a lot of problems with conflicts in at least one of the above files. Whenever this happened, I just accepted the FB3 versions of the files, and let FB4 internally deal with upgrading the format. If I somehow needed to make changes to those files (such as adding a new class), I'd either get another team member to do it, use FB3 to add the files, or just manually edit the file myself. Irritating, but not the end of the world.
YMMV.
Yes. Adobe products are extremely backwards compatible. However, some Adobe products will by default save your "older" files into the newer format - ie if you saved your FB 3 project with the FB 4 application, you may have to choose "Save As" to force it to save it as version 3 (this is true at least for Flash, not certain if Flex is different in that regard). This is only relevant if you need to retain the older file format for compatibility with other coworkers who only have an older version of the program.

Resources