Friday, March 26, 2010

Running out of logical names for a Class Name?

Look at mx.collections.GroupingCollection2.as in sdk4

3608: 'GroupingCollection' has been deprecated since 4.0. Please use 'GroupingCollection2'.

Early migrating your projects from Flex 3.x to Flex 4 (SDK) + FlexBuilder3 to FlashBuilder4 without many code changes

For a project with close to 1000+ files in codebase, there are un-doubtedly many challenges in performing an early code migration.

It’s always tough to sell your manager an idea of migrating code base to a new version. In Medium to small corporate firms, Most Managers play multiple roles of Project Management, Technical Management and Client management. Delivery manager would slightly share or buy most of what project manager informs about technical challenges or deliver dates negotiation due to challenges. There are some advantages and disadvantages for lead / front technical guys who want to prove that the new version is going to help codebase/product in long run with tremendous enhancements. Most of these managers are typically client oriented and think in terms of numbers in most occasions and are considerably less caring about migration efforts / future code enhancements especially when there was huge effort in building a stable version, well appreciated and satisfied by the client

As a Lead or Front facing Technical guy, you are pretty excited about the release & all the news floating around about Flex 4, Flash Builder 4, Coldfusion Builder and you spread your thought across to the manager making decisions claiming that it would be great to migrate codebase for a long term plan. Having worked on the long ran Beta’s (from Adobe) Technical guys know most of the new features released in these new versions

Thanks to Adobe for giving us backward compatibility with the new version of Flex 4 SDK in Flash Builder 4. If you are working on a larger project implemented with Flex 3 and wish to migrate from Flex 3.x SDK to Flex 4 SDK and FlexBuilder3 to Flash Builder 4 (for developer IDE enhancements), start off here :

  • Export Latest copy of your Source code from repository
  • Create New Flex project in Flash Builder

Export Latest copy of your Source code from repository

Assuming you are on SVN, Switch your perspective to SVN Repository Exploring Perspective and on your source trunk, Export a latest copy of your Source directory –

Hit OK and your Code is now exported to C:\flexsourcecode

Create New Flex project in Flash Builder

Start your FlashBuilder.

Right click in your package explorer and choose New -> Flex Project

Choose your application server type, debug folder, etc. (omitted here).

Proceed and

  • Select "MX only" radio option
  • Add any *.swc to your libs directory
  • Choose appropriate setting for your Framework linkage
  • Hit Finish

Your project will be listed –

  • Copy your source code (earlier exported into C:\flexsourcecode) into the newly created project here
  • Copy any *.swc into libs if you forgot to add earlier
  • You can get rid of the test.mxml file (delete)
  • Right Click properties on the project and delete the test.mxml and set your mainapplication mxml as default here

FB builds your project and reports any changes to be made.Here are the changes I had to make:

  • In Flex 3, mx:Label textDecoration="bold" property value is wrong in Flex4
  • In Flex 3, mx:Label fontStyle="bold"property value is wrong in Flex 4
  • For the above two use fontWeight instead
  • In Flex 3, mx:states, mx:AddChild, components:xyz paddingTop="0" paddingLeft="4" paddingRight="10" paddingBottom="8", paddingType in this scenario is not supported in Flex 4. You will get compiler error
  • Plus Lots of warnings...

For most you will be done here.

As you run, you notice that your CSS will not be picked up.

Pull up your CSS file and add the following line in the beginning –

You should be done now.

Do a few testes running your application. Now that you have confirmed that your application works with Flex 4 SDK (mx set only) and Flash Builder 4 (not the right way though, I mean you are not using spark components, fx namespace yet), you can sell the idea of buying Flash Builder 4 for developer productivity and enhancements.

Migrating the code to newer Flex 4 (not just via backward compatibility) would take time and can wait and go on as you do this step.

From Flash Builder 4 docs - In some scenarios you may want to use only the MX components that were available with Flex 3. For example, suppose you have an existing Flex 3 project and you do not want to introduce the new Spark components. But you do want to take advantage of features introduced with Flex 4 and Flash Builder 4, such as the new states syntax, compiler improvements, and other language features. In this scenario, you select the MX Only component set.

Thursday, March 25, 2010

Which one do you like?

"Application Startpage" or "Start Page"? I like the later but i wish they were consistent.. doesn't matter :-p !!

Tired of Seeing CF Builder Start up page?

If you have just installed Coldfusion builder, you will be shown the coldfusion builder start page every time you quit and re-launch the IDE. To get away with start page, Find the Menu option-> Window->Preferences->Coldfusion->Startup->Show Welcome page on startup and uncheck it. Flash Builder doesn't do this magic everytime you quit and relaunch, Keeps it simple. I like that.

Wednesday, March 3, 2010

Some Un-reproducible errors with Flex

Here are some errors i've encountered working on the flex and these are not reproducible (rare to see..)


RSL Error when loading application (swf)



Hidden frame for tracking browser history opens up



Famous error 2032


Tuesday, March 2, 2010

Random SOAP Faults in application (Part II - Finding the Cause of problem)

This is in continuation to my last post where some of our end users running low b/w were encountering random SOAP faults in the flex application.

To debug the problem i have requested access to one of the end users machines to see what was going on. Spending good amount of time trying to work with the end users machine didnt give any clue though. I have found that while the end user recieves the SOAP Fault in the flex application, the response sent by the server for that specific request returned just fine with HTTP 200 OK with SOAP body and header looking just perfect in fiddler (http debugging tool). I didnt have a clue on what was going wrong when the response looks perfect.

Next, I took the SOAP body from the fiddler and started looking into the Flex framework, SOAP Decoder to analyze if something is wrong with the response body content, content lenght etc. After spending more time, Everything went through fine. The response was indeed getting decoded fine and everything looks perfect. Since these SOAP Faults were random and cannot be reproducible often, it was making the client frustrating putting us through difficult situations. Time is ticking without any solution yet.

I thought of the idea of trying to deploy a debug build for one release where i enable flex framework logging. I really thought this would give hints to what is happening internally.

Call this function in your creation complete of your flex application and it would enable debugging all the messaging, rpc logs in the framework.

This link would give you complete details on what to do next to enable logging in flashlog file. After I deployed the debug build into a custom environment, I have installed debug version of flash player on couple of end users machines, configured the flashlog settings and asked them to run their tests on this custom environment swf. I should say i was really lucky to get helpful hand from the end users who were willing to nail down this problem as there was no pattern for reproducing the problem.

After couple of days, I got this error SOAP Fault hit once by the end user running the debug flex build. Without any delay i got the flashlog.txt on their machine and looked for the traces of the problem.

Without much help from flexcoders@yahoogroups or the adobe-flex-forums, I spent a lot of time trying to debug through the flex framework to identify the problem. After going through the framework code i have bottomlined it to the fact that the culprit was FIDDLER. The message is not reaching the flash player properly.

This link on the msdn gives how fiddler works. Since fiddler acts like a proxy, messages go and come via fiddler. Unfortunately Client was running old version of fiddler...In some scenarios, even though fiddler recieves the response message fine HTTP 200 OK, it doesnt throw it back to IE properly (so FP doesnt recieve it fine). One of our QA person, running old version of fiddler encountered the problem and the cause was identified by running the same scenario 20 times, with fiddler on, Flex shows SOAP Fault events vs Without fiddler on, it never shows SOAP Faults.

When the end users removed fiddler things started to work since last one week without any random SOAP Faults in the application. It looks to be problem with older version of fiddler 1.x and not with newer versions as we could not reproduce the problem in newer versions. I hope this saves someone's time. I would encourage running network sniffers instead of HTTP Debuggers for debugging purposes for these reasons



PS: The thoughts shared in this blog post are purely experimental based on what we encountered inhouse and may differ