Upgrading Flex from 3.2 to 4.5 - Errors and Warnings - apache-flex

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..

Related

Vaadin + Css formatting

I'm using Vaadin 14.4.4 with Gradle 6.3 and Spring Boot.
When I was creating a website in developer's mode everything was working well. Now I switched to productionMode = true and website doesn't load a single css file.
I'm trying to use one css file per class.
After switching back to developer's mode the CSS formatting is not working as it used to.
I tried vaadinClean, vaadinBuildFrontend and vaadinPrepareFrontend but that doesn't seem to fix my problem...
Do you guys have any suggestions does any of you interfered with the same problem as I ?
From the docs of the gradle plugin for
Vaadin:
./gradlew clean build -Pvaadin.productionMode - will compile Vaadin
in production mode, then packages everything into the war/jar archive.
Automatically calls the vaadinPrepareFrontend and
vaadinBuildFrontend tasks.
Note the explicit passing of -Pvaadin.productionMode. It might seem
a bit counter intuitive to have to pass that explicitly to a task like
vaadinBuildFrontend, which sole purpose usually is to build the
production stage.

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.

Trouble compiling flashbuilder project with sdk 3.*

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..

How to customise flex sdk classes?

I have modifyed XMLEncoder class from Flex SDK (XMLEncoder.as)
After it I run my project but I don't see any changes...
What should I do to realy modify project's behaviour?
Thanks!!!
It's not usually recommended but what you are trying to do is Monkey Patching. You can just copy your modified source file into your project and then you application's XMLEncoder will overwrite the one used in Flex (because of how the Flex linker works). This doesn't work with the framework RSLs though.
If you don't see changes, this means sources aren't used - swc is used instead. To use modified sources, recreate folder structure for the class you modified and put source there. You may see a lot of errors (most of the time because include directive), this means you need to copy files needed to satisfy dependencies.
Maybe this is not the right way, but sometimes it's the only option to fix broken Flex class, so professional Flex developer masters it sooner or later :)

ActionScript error #1053 - Illegal override of allowInsecureDomain in _MonkeyContacts_mx_managers_SystemManager (FlexMonkey code generation example)

I'm following along the MonkeyContactsCodeGenExample guide and when I run the ant target for test-with-launcher, I get a popup saying:
VerifyError: Error #1053: Illegal override of allowInsecureDomain in _MonkeyContacts_mx_managers_SystemManager.
This is followed by:
ReferenceError: Error #1065: Variable _MonkeyContacts_mx_managers_SystemManager is not defined.
These popups are from the debug flash player - the normal flash player would silently supress these errors.
It seems that these sorts of errors occur when different files or swc components are compiled under different SDKs. If so, what parts would I need to recompile in this situation?
I checked out the flex project sources and have rebuilt them under SDK 3.4, and I also got the project sources for fluint and have recompiled those already. The newly compiled fluint.swc was then copied to the lib directories of the MonkeyFluintAirTestRunner and MonkeyTestLauncher projects and then everything was re-built, but I still get this error with the MonkeyContacts example.
I just ran into this myself today. I just needed to recompile the MonkeyAgent.SWF.
As per a note on the FlexMonkey site, I used the Easy2BuildMonkeyAgent project to do this. I didn't look into why they recommended this, but it worked for me.
Beware, I ran into a problem compiling this because I use the standard 3.4 SDK that was installed separate from Flex Builder. The the standard 3.4 SDK, the automation.swc file (and others) aren't there, so I had to grab copies from the FlexBuilder 3.0 SDK folder into the 3.4.
Don't forget to copy the corresponding files from locale/en_US: automation_agent_rb.swc, automation_rb.swc

Resources