Specifying an endpoint for a RemoteObject destination at runtime

June 5, 2008

When you intend to use BlazeDS or LCDS in your App, you usually start a new project in FlexBuilder and set the Server Technology to LCDS and then Set the Root folder and Context root and validate the configuration to create the project as below.

At this point, FlexBuilder adds a -services option to the compiler and sets it to the services-config.xml where the end-points for the services are set.

You can then write code as below where the destination is now configured in the config file that’s set at the location in -services option.

<mx:RemoteObject id=”artJava” destination=”ArtGallery” fault=”errorHandler(event)” showBusyCursor=”true”>
<mx:method name=”getArts” result=”onArtResult(event)”/>
</mx:RemoteObject>

If you look into the services-config.xml you will see the following lines there

<channel-definition id=”my-amf” class=”mx.messaging.channels.AMFChannel”>
<endpoint url=”http://{server.name}:{server.port}/{context.root}/messagebroker/amf” class=”flex.messaging.endpoints.AMFEndpoint”/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>

When you run the app in FlexBuilder, it substitues the {server.name} and other variables from the configuation that you set when you created a new project and compiles this into the application. This works like a charm, but this has a problem.

Yesterday, I did an application and bundled it into a war file and send it to my friend. But when he ran it, it did not work. This was because, I had my BlazeDS installed on port 8400 while he had it on port 8080. Since my Builder had substituted the {server.name} at compile time, the only option was to give him the whole project and get him to recompile it for his configuration.

Thanks to Sujit, I discovered that you can not go this way and make this generalized by injecting these values at runtime, rather that these being at compiletime.

The trick is Read the rest of this entry »


index.template.html and its significance in Flex Project Development

March 5, 2008

I had posted a couple of posts earlier (the contextMenu based fullscreen & the fullScreenVideo) where it required you to edit the html wrapper in which the Flex App SWF is embedded. A lot of people came back to me saying that they still were getting the following error whenever they re-ran the app, even though they had edited the html source …

SecurityError: Error #2152: Full screen mode is not allowed.
at flash.display::Stage/set displayState()

So, I wanted to discuss here, why this error is occurring and also discuss a couple of things about html generation in FlexBuilder.

In FlexBuilder3, if you look at the project tree you will see a folder called “html-template“. This folder contains the following files..

  • AC_OETags.jsA JavaScript source file used by client to detect and embed the Flash Player
  • playerProductInstall.swf This implements the Flash Player Express Install mechanism which comes into play if the client does not have the required player
  • index.template.html -HTML template that is used by the FlexBuilder to generate the wrapper html for all the application files in your project.

The error discussed in the beginning is caused by the last mentioned file. Whenever FlexBuilder compiles an app, it verifies the signature of the wrapper html to the index.template.html. if there are any variations, it recreates/overwites the html file to match the template.

So, any changes that you might have made on the html is lost whenever you run the application and hence the error. There are various ways of solving this.

  1. The easiest way out is to create your own wrapper html and use that instead of the default wrapper generated. You can copy the code and then extend it with your additions on it…
  2. The above way is recommended if your project has a lot of applications inside it. But, if your project hosts only one application and other files supporting it, it would be better for you to go ahead and edit your index.template.html itself, which would then reflect in your wrapper file without any hassles.

You can also read this post by Mike Morearty on “ Changing the filenames in Flex Builder html templates” which will provide some more insight into the html-template…


Changes in Flex 3 licensing model

February 19, 2008

There have been several changes from Flex2.0.1 to Flex 3. In this post, I’ll discuss about the packaging changes in Flex Builder(FB) and the changes in licensing for the product.

Packaging changes in Flex 3

In Flex 2, we had the following types of packaging…

  • Flex Builder 2
  • Flex Builder 2 with Charting
  • Flex Charting 2

    In Flex 3, it has become as below…

    • Flex Builder Standard
    • Flex Builder Professional

      This means that the Flex Charting product that existed in 2.0.1, no longer exists as a standalone buy in Flex 3. Instead, it is packaged in the Data Visualization package (which includes Charts & its enhancements, AdvancedDataGrid, OLAPGrid… etc) which is available only with the Flex Builder Pro.

      Over and above the standard edition, the professional edition will provide premium features like Charting and Visualization components, the Profiler, and the Flex Test Automation Framework. If you need more info about prices and stuff, you can check out this post by Ted. A thing to note here is that the Automated Testing Framework is available only with the FB Pro & also that this would be the only way of buying the Automation framework of rhe product…

      FB & Data Visualization Licensing and the “licenses.properties” file

      Now, let’s talk about the licensing. In Flex2, if you had the charts.swc then you could write applications using the charting framework. But this would lead to a trial watermark to be displayed on the chart as below, which would make it useless for production applications.

      Charting Watermark

      The way to get rid of this was to get a Flex Charting license and then add it in the “Manage Flex Licenses” tab in Flex Builder 2 or add it in the license.properties file in the “\sdk\frameworks” directory.But with FB3, a whole new set of work flows emerge.

      1. If you need to use charting in FB3 using Flex3 SDK, things are a breeze. You can install FB Pro, and enter the serial no in the “Manage Flex Licenses” tab in the “Help” Menu and you are ready to roll.

      2. But, FB3 also supports multiple-sdks in it. It comes pre-installed with Flex 3 & Flex 2.0.1 sdks (you can find it in the “\sdks” directory). So you may want to still continue working with Flex 2.0.1 project in FB3. If that project has charting, you will still see the watermark, even if you enter the FB3 Pro serial. This is because the Flex 2.0.1 SDK takes the charting serial from the licence.properties file in its SDK directory (“\sdks\2.0.1\frameworks”). So the way to work around this is to enter your Flex 2 charting license in the file.

      Also, another thing to note is that if you want to manually enter the FB license in the license.properties file in Flex3, the file is now stored in a global location in the OS and not in the frameworks directory in the SDK path. The path to the license.properties file for various OS’ are given below.

      • “../Documents and Settings/All Users/Application Data/Adobe/Flex” directory on Windows
      • “Library/Application Support/Adobe/Flex” directory on MAC
      • “$HOME/.adobe/Flex” on Linux

      Happy New Year…

      January 2, 2008

      Just back from a vacation to my hometown… I have been un-plugged from the web for the past week.

      I was trying to catch up with some happenings in the RIA world and came across some posts which I thought I should share here

      HAPPY NEW YEAR to everyone…


      Free registration of FlexBuilder2 with Charting for Students & Faculty

      November 26, 2007

      Some timeback, I had written about Adobe’s announcement on providing FlexBuilder2 free of cost to students and faculty of educational institutions. I had promised more info on this, so here it is.

      First, the great news!! Adobe is giving you not just a FlexBuilder license, but also the Charting package along with it. This is great news as you can now make really awesome applications like the showcase dashboard easily. Here’s what you should do…

      1. Go ahead and create an Adobe ID here (ignore this if you already have one)
      2. Use the same page to sign in
      3. Go to the this link and download FlexBuilder & the Flex Charting package.
      4. Now go to flexregistration.com and register your product as a student or faculty
        • If you are a student, you would need to upload scanned image (GIF or PDF) of the front of your Student ID stating a current date. If you do not have a Student ID please upload a scanned image (GIF or PDF) of a letter on your educational institutions letterhead that verifies that you are a current student at the institution
        • If you are a faculty, you would need to upload scanned image (GIF or PDF) of the front of your Faculty ID stating a current date. If you do not have a Faculty ID please upload a scanned image (GIF or PDF) of a letter on your educational institutions letterhead that verifies that you are a current Faculty at the institution
      5. This info will be verified and then you can get the license key for the software.

      On the same note, here are some other resources that students and faculty can leverage if they are interested in Flex.

      Do try it out and let me know if there are any issues or queries.


      FlexBuilder to be offered free to students

      October 26, 2007

      This is one news that I wanted to shout from every rooftop, the day I heard it. But I’ve had to restrict myself, but no more !!!

      Adobe announced that it is offering FlexBuilder2 at no cost to students and faculty at educational institutions worldwide. This would be made available starting early November this year. The official press release is available online at Yahoo News


      How do I get Data Visualization Charting Components for FB Linux?

      October 3, 2007

      I was reading the FB Linux FAQs and came across the question that became the title of this post. The answer was…

      While the Data Visualization and Charting components are not part of the Flex Builder Linux Alpha, it is possible to purchase a Flex Builder 3 Professional license (either Mac or Win) and move the licensed datavisualization.swc file over to your Linux installation. This process has been explained by various users in our forums and is acceptable under the terms of your Flex Builder 3 license.

      This answer didn’t make me happy. I tried googling for the exact solution, but in vain. So I decided to post the solution myself. Here it is. The trick to make this work lies in 2 swc files existant in your Flex SDK Folder.

      Pre-Requisite: You need to have an SDK with Data Visualization Charting Components already installed.

      When you install FlexBuilder on Windows/MAC, it already comes the Data Visualization Charting Components installed, but with a watermark on them. If you have the serial number, then the watermark goes away. Now this is what you need to do…

      Caution: Please make sure that your SDK installations on Linux & Win/Mac are compatible before you follow the steps below. To do this go to [FB Install Folder]/sdks/3.0.0/bin folder and type the following on the command-line (or terminal) to ascertain the version numbers are the same.

      mxmlc -version (on WIN)

      ./mxmlc -version (on MAC/Linux)

      Steps to Install Data Visualization Charting Components for Linux

      1. Go to the [FB Install Folder]/sdks/3.0.0/ folder on your WIN/MAC
      2. Get the following files…
        • [FB Install Folder]/sdks/3.0.0/frameworks/libs/datavisualization.swc
        • [FB Install Folder]/sdks/3.0.0/frameworks/locale/en_US/ datavisualization_rb.swc
        • [FB Install Folder]/sdks/3.0.0/frameworks/license.properties
      3. Copy this to your FB Linux installation in the same directory structure as above

      This should get Data Visualization Charting Components working on Linux, complete with code-hinting. Let me know if you have any problems.

      Addendum: I had overlooked the need for continuing to use Charts in Flex2.0.1 on FlexBuilder. In that case, you can copy the file [FB Install Folder]/sdks/2.0.1/frameworks/libs/charts.swc to the same location in the 2.0.1 SDK delivered with the FB Linux. You can also copy the file [FB Install Folder]/ sdks/ frameworks/ license.properties from your 2.0.1 SDK in Windows to the same location in the 2.0.1 SDK in Linux. This should get rid of the watermark if you have a license.


      FB on Linux – Beneath the Surface

      October 3, 2007

      I thought it would be worthwhile to look beneath the covers and explore a little bit more of FlexBuilder on Linux (I still need to get used to calling it that, having called it by the code name for so long).

      1. Unsupported Features

      • Design view
      • States view
      • Refactoring
      • AIR support
      • Automated testing
      • Data Wizards
      • ColdFusion Extensions to Flex Builder
      • Web Services introspection
      • Profiler
      • Data Visualization components

      What you need to understand is that the above features may be unsupported for many reasons. It may well be that it is not still implemented or that we want the community to speak up on which of these features is desired, if so. So let your voice be heard on the FB Linux Forum

      2. System Requirements

      • This release of FB Linux requires Sun JRE 1.5.x and Eclipse 3.3
      • Flex Builder Linux Alpha only supports Firefox (all versions).
      • Flex Builder Linux requires the debug version of Flash Player (Linux) to support debugging applications from within Flex Builder Linux alpha. Download it here…

      3. Logging Bugs on FB Linux

      As I mentioned earlier. You can log bugs on FlexBuilder Linux on our Flex Public BugBase under the FB Linux Project. It would really help us if you can provide the following information while doing so.

      • Which platform & version on Linux are you working on?
      • The exact steps for reproducing

      What you need to remember here is that a bug may be due to various reasons…

      1. A bug in the FB Linux code
      2. A bug in the FlexBuilder itself (Win, MAC & Linux)
      3. A bug in Eclipse
      4. A compatibility issue in a specific OS
      5. Others (in the SDK… etc)

      If your bug falls in the (2) Category, it would be great if you can log the bug under the FlexBuilder project instead of the FB Linux project. This would help us solve the bugs in a speedy manner.

      For more details, you can view the FB Linux Release Notes and FAQs


      Moxie & TUX – Flex Builder on Linux

      October 3, 2007

      It really heartens me to see the fervor with which the Linux community has taken onto Flex. We at Adobe have shown our commitment by rolling out Flash Player for Linux. Now with Flex going open-source, I see a bright future for Flex on Linux.

      But the major complaint that almost all Flex Devs on Linux has raised is the unavailability of FlexBuilder on Linux. This in a way is a validation for the IDE that makes coding simpler and debugging efficient. We got to work on it and it has borne fruit 🙂

      Here’s presenting FLEX BUILDER ON LINUX !!! FB on Linux is supported on the following platforms…

      • SuSE Linux Enterprise Server 10 (x86 32-bit version)
      • RedHat Enterprise Linux WS 4 (x86 32-bit version)
      • Ubuntu 7.0.4 (Feisty) (x86 32-bit version)

      You can make FB Linux work on 64-bit Operating Systems also. See the FB Linux ReleaseNotes for the same or even better, Tom Chiverton has a post that demystifies things

      We have also launched a Labs forum for FB on Linux, so let your voices be heard. This is still in alpha and we need your valuable comments to evolve it into a product for your needs. Also let us know if you find any bugs. You can log them directly onto our Flex Public Bugbase under the FlexBuilder Linux Project.

      This is a huge leap for us in the Flex team and I’m proud to be sitting next to the folks who engineered this product and made this happen…. 🙂


      Registering FlexBuilder with serial numbers for multiple versions of SDK

      September 12, 2007

      With the advent of FlexBuilder3, Adobe has added a very cool ability to be able to access multiple SDKs and also switch between them. This feature would work for SDK versions of Flex2.0.1 onwards. But this has caused quite an interesting issue to surface. Read about it here…

      In short, the problem is as below. I have installed FlexBuilder3 and when it opens up for the first time, I enter my license keys (for the builder as well as for charting). The builder by default, when it starts for the first time, uses Flex3-Moxie framework to compile the projects. I make a project with a chart in it and it compiles and the chart shows up without a watermark.

      Now I go and change the SDK to Flex201 and recompile and run the app. But this time, I’m stumped to see that the chart appears with a watermark.

      The solution though not apparent is a simple one. There are 2 ways to fix it…

      1. Solution for Dummies

      1. Open FlexBuilder
      2. Right Click your Project and choose Properties
      3. Choose Flex Compiler -> Configure SDKs -> Choose Flex201 and press OK
      4. Make sure you have selected “use default sdk” option
      5. Restart FlexBuilder
      6. Choose Help -> Manage Flex Licenses and enter your chart license key again. Press OK. You might get an error at this point, but ignore it.
      7. Re-compile App (better to clean the project) and Enjoy !!!

      2. Solution for Geeks (who want to know why it happened !)

      The reason for this problem is that FlexBuilder uses a license.properties file found in the frameworks directory of the sdk. The sdk’s pre-configured in your FlexBuilder can be found at <FBInstallationDir>/sdks. So when you give the license key for the first time it writes to the license.properties file of the Flex3SDK and not on the Flex2.0.1 SDK. This is why switching the SDK causes the watermark to appear again.

      So, another way of fixing this is to copy the license.properties file from Flex3SDK/frameworks directory to the Flex2.0.1 equivalent. And you are ready to develop in full-fledged versions of Flex2.0.1 and in Flex3.