Trouble compiling flashbuilder project with sdk 3.* - apache-flex

I have a series of projects that we have been using Flex3/Flashbuilder to work with, but I've recently been trying to move over to Flashdevelop for most of my development but I have hit a snag with a certain project structure that Flex/FB can handle but FD/mxmlc can't with sdk 3.*
What I have is something like this:
project_root/
/src
/resources
The resources in flex is added as a class path to the project and I am embedding images like this: [Embed(source="/wardrobe.png")]
This all works fine in Flex/FB but FD I get there errors for all my images :
Error:unable to resolve '/wardrobe.png' for transcoding
Error:unable to transcode /wardrobe.png
This problem don't occur when I'm using the Flex 4 sdk, but for these projects I require 3.2. If anyone has any idea of what these projects won't build and a way to make them work outside of Flex/FB that would be great.

Good news:
there is a reason why the Flex 3 SDK does not resolve embeds in the entire classpath but only the class' one.
Bad news:
it's a bug which is not going to be fixed in Flex 3 SDK (it's ok in Flex 4 SDK).
As a matter of fact, both FlashBuilder and Maven Flexmojos use a workaround (they inject a custom "resource resolver" in the compiler).
Solution:
The best you can do is to fix embed paths like: "/../resources/wardrobe.png" (the starting "/" makes the path relative to the class' classpath root).

try cleaning the project
i don't know where in flex builder but in eclipse it in Project>Clean
then build again the project..

Related

Flash Builder compiling swc and no swf

I've got an old Flex project I have to bug fix - and Flash builder is now refusing to compile a swf. I'm getting a swc only in the output directory in run or debug.
Does anyone know why Flash Builder might do this? Any settings I'm not aware of?
Flash builder will create swcs for library projects. There is probably another "shell" project that depends on the project you're looking at;
However, if I assume that this was supposed to be a regular Flex project, and it got converted into a library by mistake, you can change it back by editing the .project file in the project root. Look for the following XML element in that file:
<natures>
<nature>com.adobe.flexbuilder.project.flexlibnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
Change that to:
<natures>
<nature>com.adobe.flexbuilder.project.flexnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>

Customize Adobe File

I have a problem with my Flex Builder Plug-in.
I'm using the Flex Builder 3 Plug-in in my Flex application (in Eclipse).
Now I want to customize the MessageResponder.as File in the Plug-In. I found the ActionScript File without any problems, but the point is, that my changes doesn't cause anything because the file is allready compiled. (That's my guess)
Now my question:
How can I compile the file after editing it? Is there a possibility at all?
Thanks for your help!!
What you want to do is called "Monkey Patching." What you need to do is create your own version of the file in the same package location, and yours will be used in preference to the one from the swc.
The MessageResponder.as class is a file in the Flex Framework. You can modify it if you want, and--in essence--create your own version of the Flex SDK. However, you will most likely have to re-buld the entire framework for this to work. You're best bet for doing this is to get the source for the most current Apache Flex SDK; modify your class and then build the framework from scratch. After that you can use the Flash Builder "multi-SDK feature" to use your modified SDK in a Flex Project.
I'm not sure if Flex Builder 3.x supports multiple SDKs.
This may be a time consuming process. The alternative is to extend the MessageResponder and add your changes. Then you'll have to make sure that your new MessageResponder class is used instead of the old MessageResponder class. This could difficult due to many private methods used in the Flex Framework.

Upgrading Flex from 3.2 to 4.5 - Errors and Warnings

I've inherited a large codebase written primarily in Flex 3.2 using Parsley and Cairngorm.
The entire build process is done through maven using FlexMojos.
I'm relatively new to Flex and I've been told to upgrade Flex from 3.2 to the latest 4.5.1 version.
While I have made a good progress, I have run into some errors that are beyond my understanding or Google search has not been able to help.
Things I have done:
Changed all namespaces to mxml 2009 and fx.
Put all non-visual components in fx:declarations.
Added namespaces in my stylesheet
Upgraded version of FlexMojos to 3.9 - not 4 because there isn't a stable version yet
Upgrade all cairngorm dependencies to the Flex 4 dependencies, although keeping the same versions.
Exclusively declared that the theme I want to use in the compiler settings is halo.swc
Fixed a lot of compilation warnings and errors which were trivial.
Things I don't know how to fix:
While compiling, I get a lot of warnings with regards to CSS.
An example of warning I get is the following:
[WARNING] C:\repo\com\adobe\flex\framework\framework\4.0.0.14159\framework-4.0.0.14159.swc$defaults.css:[487,-1]
The style 'dropShadowVisible' is only supported by type
'mx.controls.List' with the theme(s) 'spark'.
For a start, I'm not using 4.0.014159, although something's telling me that the dependency is being pulled through a Cairngorm library such as validation or module.
If so, any solutions to that?
Additional warnings I get which I don't understand how to fix are the following:
[WARNING] The swc
'C:\repo\com\adobe\flex\framework\framework\4.5.1.21328\framework-4.5.1.21328.swc'
has style defaults and is in the library-path, which means
dependencies will be linked in without the styles. This can cause
applications, which use the output swc, to have missing skins. The
swc should be put in the external-library-path.
Regarding the above, I read somewhere that the swc file has to be loaded as an external library path instead. I did that but the warning didn't go away.
Finally, the app fails to compile as a result of these errors.
[ERROR]
C:\repo\com\adobe\flex\framework\mx\4.5.1.21328\mx-4.5.1.21328.swc$defaults.css:[469,-1]
Invalid Embed directive in stylesheet - can't resolve source
'Embed(source = "assets/CalendarIcon.png")'.
There's no reference of the CalendarIcon.png asset in my codebase. Google pointed me out to this http://python.mmitd.com/bugs.adobe.com/jira/browse/SDK-22746, but I'm afraid nothing I've done worked.
As you can see the majority of my warnings/errors (at least for now) lie around default.css warnings.
Any help will be greatly appreciated!
Flex compiler, by default uses a css, which is named as "defaults.css". If you have the css named as "defaults.css", change the name of it.
It will also look for flex-config, which should be same as application name or it will take a default flex-config from the sdk folder. There are couple of css properties, which are only available in Flex 3 components. Now as we have the Spark component architecture in place, few properties may not work at all and give you warning messages.
If you have Flash Builder installed on your machine, you can import your project in it and go through the warning messages one at a time and fix your .css file.
Hope it helps you somewhat in resolving the problems..

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 drawing example error

I am new to flex and i am trying to run the code for flex drawing application example given at following path:
http://www.flashcomguru.com/components/flex_whiteboard/whiteboard_demo/srcview/index.html
But I get the following error at the compile time:
''Unable to locate specified base class 'Whiteboard.WhiteboardManager' for component class 'Whiteboard.Whiteboard'.''
Please someone suggest me that why it is coming and how i can overcome this.I am using Flash player version 10 and flex 3.0 sdk for the project.
Please help.
Thanks in advance.
You need to include the WhiteBoard.swc library in your project. If you're using Eclipse/Flex Builder go to project properties -> flex build path -> library path -> add swc. Or moving it to the libs folder should be enough.
The sources for the component are not included in that demo as it is not a free component. I didn't see a demo version either, so unless you buy it, you probably won't be able to run those sources locally.
Sounds to me like your source paths aren't set up correctly. Have a read of this article to see how source paths are set up
http://www.cove.org/ape/quickstart_fb.htm

Resources