Exporting release build - Flex through Intellij Idea - apache-flex

How do I generate release build of my Flex Application
through IntelliJ Idea, like I do in Flex Builder?

Right click on any project and select module setting.
Select tab "Flex compiler setting"
Last field on this tab is "Additional compiler options:"
add "-debug=false" without double quotes to it.
Do this for all the subprojects. (From this form only you can choose different projects).
do a project Rebuild and you will get a smaller swf.
Only problem is you need to keep separate project files for debug and release build, but thats ok, as you release builds are done rarely.

Alternate answer:
Instead of creating a Flex Module, create a Java Module, and add 2 Flex Facet's to it. One facet will be configured as the debug facet, the other as the release facet. This process will create 2 swf files, debug and release versions.
Create a java module, for example "FlexHelloWorld". Do not add a flex facet yet.
In the project view, right click on the project and select module setting
Under the Modules option, select the "FlexHelloWorld" module
Click the "+" symbol, add Flex Facet
Rename facet to "Debug"
Enter your main class name
Enter "debug.swf" as the output file name
Click apply
Click the "+" symbol, add Flex Facet
Rename facet to "Release"
Enter your main class name
Enter "release.swf" as the output file name
Under additional compiler options, add "-debug=false -optimize=true"
Click ok
Build the module. In the output directory, you will have "debug.swf" and "release.swf" files.
Note: In your HTML wrapper, you will have to call either debug.swf or release.swf. Or you could create 2 wrappers.

Does IntelliJ support Ant? Maybe not the answer you're looking for, but you could use the Flex Ant Tasks to build outside of FB.
http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html

Related

Reduce size of swf from Flash Builder

I have created a simple Flash Builder 4.6 project containing a simple button, and i have exported the project with release option, with mx namespaces.
The problem is that the file size is aboud 266 kb with the compile option: Merged into the application. I use only a simple button. My question is there is a way to remove any reference to mx library that i don't use in my code in order to reduce the swf size.
The option "Merged into code" will actually already figure out what needs to be compiled into the application and strip out code that you don't use. As a test, try adding another different component and create another release build. You'll notice that the filesize is bigger.
The best way to reduce the swf size is to use Runtime shared libraries (RSLs). This is the default linkage option of the SDK.
http://livedocs.adobe.com/flex/3/html/help.html?content=projects_7.html
try this:
Project -> Properties -> Flex Build Path
Make sure the combo "Framework linkage" is selected with the value: 'Merged into the code'.
Below you should have a tree named "Build Path Libraries".
Expand the first node. Then try to remove the libraries by selecting the relative node and clicking on the Remove Button on the right

Flex - how to switch to another SWC theme at run time?

My goal is to have more themes for my application and if possible, bundle them with the application itself, not load them at runtime using IStyleManager.loadStyleDeclarations().
Using the theme command-line option, you can have more than one "compile-time theme" bundled with your application according to docs:
theme filename [...] Specifies a list of theme files to use with this application. Theme files can be SWC files with CSS files inside them or CSS files.
However, I wasn't able to find an example how to actually do that (use the += syntax on command line?) and switch between those themes at runtime. What API should I use?
Using the theme command-line option, you can have more than one
"compile-time theme" bundled with your application according to docs:
Yes, You can add additional themes using the += in your command line.
I do exactly this for the Flextras mobile demos; including both the generic Spark theme with the Mobile theme to create the app.
However, both themes will be attempted to be used. I believe the second takes precedence. That means for every class where you want to use the "other theme" you have to specify that theme be used manually. This could get pretty complex very quickly; and you'll have to re-create a lot of spark skins in your application. I've done some work for a client around this who wanted to use our mobile DropDownList in both their normal application and in a mobile application from the same code base. I think the appropriate skin is conditionally applied at runtime using CSS; however we had to create a skin for the "non-mobile use" that explicitly specified the non-mobile skins for the individual elements (Such as the scroll bars)

Project or Workspace specific Indentation in Xcode4

Is there any way to setup different indentation values for a specific project or workspace?
I've started working on a new project that uses a different indentation level then I've been using, and I would love to be able to set a custom value for that project, or setup a workspace for it, so that I don't have to think about changing indentation values when moving between projects. I've searched around but haven't had any luck finding any discussion about it.
I came across this question/answer: Is it possible to set indent settings in Xcode per project (or per file, even)? This is the exact same problem that I have, however the solution does not seem to be available in Xcode 4.
Open the file inspector by choosing View > Utilities > File Inspector. Select the project file from the project navigator. Use the Text Settings section in the file inspector to set the indentation for the project.

Xcode 4: How to Add Static Library Target Dependency to Project

I know, this has been asked a few times, but mostly for Xcode 3.x. For the iPad, I have two projects both living in a common workspace
Foo, a view-based application and
Foolib, a static Cocoa-Touch library
the former depending on the latter. I seem unable to work out how to add that dependency. It's not well explained in the documentation, so I tried the following:
Click on the Foo project in the Navigation Area on the left,
Select Build Phases up the top and expand the Target Dependencies section
Click the plus button, but the resulting list is empty.
I have also tried to drag/drop the .a file into that section, with little success. Also, the documentation states
If the build product of one project in a workspace is dependent on the build product of another project in the workspace (for example, if one project builds a library used by the other project), Xcode discovers such implicit dependencies and builds in the correct sequence.
I wonder how Xcode discovers those dependencies. Is Apple saying I don't have to add this target dependency at all? But then how would Xcode discover that one is using the other?
Last but not least, I will need to get the .h files from Foolib across to Foo somehow. What is the recommended way of doing that? Obviously, I don't want to just copy them. With frameworks the header files come included, but what do people generally do when working with static libraries that they themselves develop in parallel.
A nudge in the right direction would be much appreciated. Thank you.
In general Xcode 4 seems to discover the dependencies automatically as the Edit Scheme sheet implies. Other developers have mentioned that the dependencies are not automatically discovered and require explicitly listing them:
So, Edit Scheme -> Build -> add targets from your workspace.
As far as the static library header files go, Xcode 4 seems to have a problem, at least with code completion and syntax highlighting. The only way I can get either to work properly with classes in static libraries to to drag a copy of the header files in question to a location into a group folder in the main project. Note that you should uncheck Add to Target... That takes care of the syntax highlighting and code completion. The rest should be handled by giving it the proper header search path. That would be User Header Search Paths = $(BUILT_PRODUCTS_DIR) - depending on how you set up your locations preferences.
See: this link

flex4 sdk in flexbuilder3, debugger partially works

If I changed used in one of my project sdk to current sdk4 beta, set breakpoint and stop on them every occurrences of mx.* packages are labeled "[no source]". Is known any trick to fix this issue?
Not sure why Flex Builder isn't figuring it out by itself, but you can manually set the source path of any swc on the library path (you have to do this for each project):
Right-click on the project, Properties
Flex Build Path property page
Library Path tab
Expand the "Flex 4.0" node at the top, then expand the swc that you want to attach source to
Double-click the "Source attachment" line, and specify the root dir of the source, e.g. C:\...\mysdk\frameworks\projects\framework\src

Resources