converting Adobe AIR to Flex application - apache-flex

We have a Adobe AIR desktop client which talks to a WAMP server. How can i convert this AIR app to a Flex app to be used in the browser.
Please let me know.
Thanks
vish.

I would create a new empty Flex application and copy your files into that project. Then move any code in your main app component (which is derived from WindowedApplication) into the main app component in your new project (which is derived from Application). You'll also have to go through your app and determine which components are used that are specific to AIR and rework them to use other Flex components (the compiler will complain if you don't). This should give you a good start.

I would move everything into a Flex library project. Then have an AIR project as well as a Flex app project which accesses the common code in the Flex Library project. This way you don't have to maintain two different codebases for common code and you can also have code which is specific to each version.

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.

Flex Builder Plugin in Eclipse - Some Controls not available !

I downloaded Flash Builder from here : Download
I recently started writing some small programs in Adobe Flash Builder Plugin for Eclipse.
I am trying out those programs by reading out the Adobe book : Training from the source.
But, I found that some of the controls mentioned in the book for some e.g, such as ApplicationControlBar doesn't appear in the Adobe Flash Builder 4. That control is mentioned in the book, but unable to find in the Builder.
What should I do ? Any suggestions ?
I suppose you've created project using Flex 4 SDK which is default in Flash Builder 4. And the book covers Flex 3. So Flash Builder created spark Application container (from Flex 4) where ApplicationControlBar isn't actual anymore and replaced with controlBarContent property which allows to skin Application more flexible way.
So I can recommend you the following 3 solutions how to use Flex 3 (to be compliant with the book) in your project:
The easiest way to switch existing Flex 4 project to use Flex 3 is the following. Open project properties then Flex compiler > Flex SDK version > Use a specific SDK and select Flex 3 SDK which should be available there. Then you need to create new application in your project, select it as default using context menu, copy old application context to the new one and delete old application file. But I suppose it is better to create new project as far as you are dealing with sample apps from the book.
So just create new Flex project and select the right SDK version on the New Project master's first page.
If you plan to use only Flex 3 for your book's playground workspace you can set Flex 3 SDK as default so you won't need to select the right version on project creation. Just go to the Preferences > Flash Builder > Installed Flex SDKs and select the default version. You can go there right from the new Flex project wizard by clicking Configure Flex SDKs…
Hope this helps!
I've never seen or heard of an ApplicationControlBox. Perhaps they were referring to the ApplicationControlBar and that it's just a typo.
Adobe has some great documentation out there on each of its packages and classes. It's a great place to start if you ever have a question about one of the components.

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.

Flex Library Project: NativeMenu vs. ContextMenu

I have a Flex Library Project which has both Flex specific classes, and Air specific classes.
When I reference the library in an Air project, the compiler complains about an overriding contextMenu in mx.containers.Panel, saying that the param should be of type NativeMenu (instead of ContextMenu). If I switch it over to NativeMenu then it compiles fine.
The issue is when I reference the library in a Flex Project. This time it complains that it doesn't know the type NativeMenu. If I try to change it back to ContextMenu, then I get the same error as above.
I've searched google to no avail (found that someone else encountered the exact same problem: http://forums.adobe.com/thread/598791?tstart=-1 )
The docs don't help too much either, except stating the above: http://livedocs.adobe.com/flex/3/langref/flash/display/InteractiveObject.html#contextMenu
I'm thinking that its just not possible to do the mixing of Flex vs Air SDKs that I want, but I was hoping that maybe someone has figured this out.
Thanks!
You can't really target the web Flash Player and the desktop Player using the same project.
I would recommend encapsulating out as much functionality as possible into a library project. Then create a single Flex project and a single AIR project, both using the same library project.
Each respective project can extend, or replace, the different functionality.
I am not sure if this is the exact same problem, but I was having an issue with being able to reference the AIR libraries in a Flex Library project and found the (rather simple) solution.
Using Flash Builder 4.5, when creating a Flex Library Project, (right-click .. New.. Flex Library Project) there is a checkbox for "Include Adobe Air Libraries" at the bottom. This must be checked or AIR libraries will not be included.
When you select the version of SDK/AIR you are using in the dropdown, the message should also indicate what the minimum version of AIR required is for your application.

Flex and AIR passing data between each other

I’m looking for some samples/tutorials/general pointers in doing either of the following.
1) Create an AIR app that can load a live flex app and use that for testing. So we have a app which is live and if I could load that into a AIR app which can edit a config file and then test that config file using the live swf but inside the AIR app to make sure that if doesn’t break the flex app before uploading new config for the live app.
2) Or I’ve heard of being able to drag data from an AIR app into a flex app. If so then the AIR app could pass the test data across to the flex app and it would refresh and we could see whether it works or not.
I've looked into this a bit now and it looks like using the clipboard and some javascript seems like the way forward. Save data in clipboard from AIR app then read clipboard using javascript and send to flex app. Has anyone any other ways of transferring data between AIR & flex.
Also 'You cannot access shared objects across sandbox boundaries.' is from Adobe docs which I'm presumming means that an AIR app can't share the same 'flash cookie' as a flex app. Is this correct?
Has anyone any other ways of
transferring data between AIR & flex.
flash.net.LocalConnection is the standard method of doing this, and although it has its quirks, it works quite well. This is what I use to transfer data from a Flex app (that's running in a browser, although it shouldn't matter whether it's running in the browser plugin or the stand-alone Flash Player) to an AIR app.

Resources