Importing flex compiled swf into a flash file - apache-flex

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.

Related

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.

Upgrading Flash AS3 project to CS5 and using Flash Builder 4 as IDE

I have been working for quite some time with the Flex Builder (3) as the development IDE,
and used Flash CS3 to compile my flp file (all the actionscript I wrote in the Flex Builder).
I don't use any of the Flex components. Pure AS3 and FLA for symbols.
I want to upgrade to CS5, and I read that there is a new Flash builder IDE so I thought I'll give it a try. But In the Flash builder I see that they have tighten the Flex SDK relation (which is kinda stupid since they change the name from Flex to Flash?) so I am a bit stuck with how to migrate my project.
Furthermore, is there a way to download the Flash 10 compiler/SDK or whatever to make it compile from the Flash builder, and not use Flash CS5 for it?
Thanks a lot.
Chen
You can create pure AS3 projects with the FlashBuilder IDE without worrying about the Flex framework. Simply create a new Actionscript project. You can then compile your project in FlashBuilder and strictly use CS5 for your graphic assets.
In order to migrate your project , you only need to add your classes folder to your project source library.
With Flash CS5 , export a SWC and add it to the project's library path. All this is accessible via your project Properties.
From that point on, you should be able to access both your project classes and your symbols by declaring your variables with the relevant classes.
Edit
Start simply, first create a new Actionscript project in FlashBuilder.
http://help.adobe.com/en_US/flashbuilder/using/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d21-7ff7.html
After you successfully created a project and tested it, you can then add the code from Login.swf.
If you've been using a Document Class, you could create an instance of that class and add it to the stage, you could also simply copy the code in your Main class.
If Login.swf doesn't use any graphical assets, you should be good to go, without the need to load any SWCs.
You could also refactor your code so that each concern is encapsulated within its own class. For instance, if Login.swf serves as user login and loads a bunch of SWFs, it may be a good idea to create a Login class and an AssetsLoader class.

Flash Builder 4 Release Build multiple files

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)

Convert Multiple SWF files to Single EXE

Hi I have an application in flash, I build in ActionScript 3.0 Flash IDE, my application loads some external swfs which mentioned via XML file. Its working fine at the moment. But I need to compile all these external SWFs and xml file into single exe file. How can I compile like this. or how can I code like this?
EDIT: 1
from here : http://page-flip.com/products/pdf-publisher/
You can see an example, the application is build in .net and it import pdf and publish it as flash projector or web based(swf). How is it compiling all the external SWF files.
If you have Flash CS4 you can make use of the mxmlc compiler which has some additional tricks up it's sleeve.
Using the embed tag like this will allow you to embed an entire swf "inside" your swf:
[Embed(source = '../assets/items/9.swf')] public static const ITEM_9:Class;
Then, to instantiate it you simply go:
var mySprite:Sprite = new ITEM_9() as Sprite;
Using this and some clever overloading of your current classes for external loading should allow you to get a single swf (xml files can be embedded in a similar fashion).
Then it's just a matter of using the Publish settings to make Flash spit out an .exe
On an unrelated note, please go back and accept some answers to your questions. It's not very nice not to.
You can try mdm Zinc.
Zinc is really powerful. It lets you package your Flash or Flex in different ways, with lots of native platform hooks.
you can build an AIR application. if you don`t want it to be cross platform, you can build an AIR application with a windows native installer.
Flash > File > Project settings > Windows Projector.
For MAC, choose a MAC projector.
If you are burning to a disc and you need both platforms to work...a good option is to use Toast (if you are on a MAC)...it will hide the files you don't need the user to see, and also hide windows files from MACs and vice versa.
There is an application for Windows called SWFKit, which allows you to package your SWF and external files into one exe file. I had the same problem as you, and this worked a treat for me. Unfortunately you do need to pay for it :( http://www.swfkit.com
Hope this helps,
Will
I would go about it with these steps
create a flex application
embed all of the SWF's and the XML into that application
create a release of the application you just created
open the SWF application with the stand-alone flash player and not with the browser
from the file menu select the option create projector
All of this will result a single EXE file that contains all of the SWF's and the XML file.
You can use a projector or make an windows only AIR project.
Use flajector and forget about your problems

Why does Flash Builder 4 use Flash Player instead of a browser to run apps?

I've got an old flex builder 3 project that I imported into Flash Builder 4, and I want this project to run its web applications in my web browser. However, the apps persistently run in the Flash Player instead. This is causing no end of problems because of the flash player bug documented at https://bugs.adobe.com/jira/browse/FP-209.
How can I make a project's apps run in the browser instead of the player?
This issue can be caused by HTML generation being disabled. In the project property panel:
Screen Shot of the settings http://img685.imageshack.us/img685/1487/screenshot20100422at124.png
In your debug configurations, make sure that the url or path to launch points to the html file that the swf is embeded in, not the swf itself. You can reach the debug configuration menu by clicking the little arrow next to the debug bug icon... (and probably some other way, but i always use that menu).

Resources