You are viewing the Articles in the News Category

Query String Inspector for Flex

It is common for Flex applications which are deployed to an application server to require specific parameters be provided via the applications query string.

The Flex Framework Application class provides a parameters property which contains the query string provided to the application as well as the FlashVars HTML parameters provided to the application. This is very useful as developers are no longer required to facilitate interoperability between ActionScript and other languages, typically JavaScript, just to get an swf applications query String.

The QueryString inspector is an all static class which takes advantage of this by providing an API which allows developers to perform detailed inspection of an applications Query String.

Below is a description of each method:

  • rawQueryString: Retrieves the raw query string provided to the application
  • isProvided: Determines if parameters have been provided to the application
  • nameValuePairs: Creates an Array of objects comprised of each name / value pair provided to the application
  • parameters: Retrieves the parameter names provided to the application
  • values: Retrieves the parameter values provided to the application
  • containsParameter: Determines if the specified parameter has been provided
  • containsValue: Determines if the specified value has been provided
  • getValue: Returns the value of the specified parameter
  • length: Returns the length of the query string

FileWriter API for Apollo

I have published a simple FileWriter API for Adobe Apollo which is essentially an all static class providing methods for synchronous and asynchronous File creation.

FileWriter encapsulates file creation in an all static class which can be used to easily and intuitively create files to a local file system simply by specifying the name of the file to create as well as the path in which to the file is to be created.

FileWriter will create a new file if the file does not currently exist and return an open FileStream referencing the file object via FileMode.WRITE, otherwise FileWriter will open a previously created file and return an open FileStream referencing the File via FileMode.UPDATE.

You can view the source as well as download the basic sample application which allows you to create a File to your desktop utilizing the FileWriter API.

FileStream namespace bug in Apollo

One thing that you may encounter when attempting to use the FileStream Class in Apollo is that it does not resolve to the correct package.

For instance, FileStream is mistakenly located in the flash.events namespace but is actually defined in the flash.filesystem namespace. This creates a problem when you try to import FileStream in the Eclipse IDE as intellisense will not locate the class. However, FileStream does not resolve to flash.events. FileStream and you will get a compiler error if you attempt to import flash.events. FileStream, even though intellisense will find it.

So the solution is to simply import flash.filesystem.FileStream as it is intended to resolve to this package even though you will not see it using intellisense. This is a weird bug that can leave you scratching your head for awhile so I thought I should mention it here.

Remember that this is just the initial Apollo Alpha and I am sure that this bug will be addressed in the next release.

Cairngen Roadmap

It has been awhile since I initially posted the pre-alpha release of Cairngen in early January. As I had mentioned in the original post, Cairngen was simply a tool which I created to help speed up my own personal development process when building Flex applications with Adobe Cairngorm. My intentions were to share the project “as is”, as I had assumed other developers would certainly benefit from using Cairngen to quickly generate Cairngorm classes and project directories. I have since received numerous E-mails from many developers who are using Cairngen and the feedback has been very positive.

In part, I released Cairngen to demonstrate just how easy it was to build a simple tool to generate Cairngorm projects and templates. From start to finish the pre-release version of Cairngen took around 6 hours or so. Another reason I released Cairngen was in the hopes that other developers with the required time available would take an initiative and build a proper Eclipse based plug in version of Cairngen.

Since Cairngen’s pre-release, there has been many developers building their own versions of Cairngen in other technologies, and I see this is as a very good thing for the community. Originally, I was contemplating releasing Cairngen to the community as an open source project in order to allow developers the ability to extend the APIs to suit their particular needs. This would alleviate much of the need for my continued maintenance and support of the project.

So what is the future of Cairngen moving forward? Ultimately, I have decided to re-develop Cairngen from the ground up as an Apollo application. Building Cairngen in Apollo will give me maximum flexibility and allows Cairngen to run as a stand alone application. I still have some additional research to complete before I can officially confirm, however, it will definitely be possible, and it will also help build interest in the Apollo community as well.

So if you are developing applications with Cairngen you can expect the version 1.0 release to be available as an Apollo application shortly after the alpha release of Apollo is available. If you have any requests for the 1.0 release feel free to comment.

Release version API

I have published a software release version API which allows developers to set valid software release versions for a Flex 2 application. Release versions can be utilized for specifying additional meta data within a Flex application.

The release version API contains a main entry point, ReleaseManager; a Singleton containing a reference to the ResourceBundle instance which comprises each valid release code.

A release is set by specifying a valid release code which is defined as a constant in the ReleaseCodes class as follows:

Each release code is mapped to a corresponding value in release.properties as follows:

  • SR00PA=Pre-Alpha: {0}.{1}.{2}
  • SR00AV=Alpha Version: {0}.{1}.{2}
  • SR00BR=Beta Release: {0}.{1}.{2}
  • SR00RC=Release Candidate: {0}.{1}.{2}
  • SR00GA=General Availability Release: {0}.{1}.{2}
  • SR00UR=Unstable Release: {0}.{1}.{2}
  • SR00SR=Stable Release: {0}.{1}.{2}

The tokens in each release code are substituted by the developer according to a projects current release version; major, minor, revision/build.

You can download source as well as view the ASDocs

Label statement in AS3

In ActionScript 3 a label statement is used to associate a statement with an identifier which can be referenced by both the break and continue statements to exit a block of code. Basically, a label statement is the equivalent of goto in C – yes, I know what you’re thinking!

For instance, in a nested loop, a break or continue statement will only break out of the immediate loop and will not skip the entire series of loops (the end of the outer most loop) as one might expect. Labels are used as identifiers for an entire block of code from which a break or continue statement can reference in order to skip the entire series of loops or a specific loop from within a series of nested loops.

An example of how a label statement can be used to break out of an outer loop is as follows:

A label may also be referenced by a break statement to exit a block statement as follows:

Typically, it is rare that you would need to use the label statement, however, in certain situations if it is necessary and can be justified, the label statement provides a convenient way to exit code.