Pages

January 3, 2012

Testing for a Flash Builder Pro License

Posted by Jeremy Mitchell
Certain features of the Flex SDK require a valid Flash Builder Pro license to function properly. Examples include charting and automation. For example, if you compile a SWF without a valid Flash Builder Pro license, you'll get the following results:

Charting

Charts compiled without a Flash Builder Pro license contain a watermark.


Automation

Test automation tools (i.e. FlexMonkey) that interact with a SWF compiled without a Flash Builder Pro license will trigger a "License not present. With the trial version only limited records are allowed" error.


A Solution

To avoid these results, simply enter a valid Flash Builder Pro license into Flash Builder and compile your SWF using Flash Builder. Duh.

A Catch

Most enterprise applications are not compiled using Flash Builder. Instead, the build process directly utilizes the command-line compilers, MXMLC and COMPC, in tandem with Ant or Maven. In this scenario, the Flash Builder Pro license key must be entered into the configuration file (flex-config.xml):

    <licenses>
        <license>
            <product>flashbuilder45</product>
            <serial-number>xxxx-xxxx-xxxx-xxxx-xxxx-xxxx</serial-number> <!-- this is my 4.5 license key -->
        </license>
    </licenses>

Another Catch

When using Ant or Maven, you may find out that your Flash Builder license will NOT work for all Flex SDKs. For example, a Flash Builder 4 license will not activate charting or automation for the Flex 4.5 SDK...but it will for the Flex 4.1 SDK. (see related StackOverflow post)

Testing for a valid Flash Builder license

Well, one way to ensure that a valid Flash Builder Pro license was compiled into your SWF is to simply check out your charts or your automation scripts. For charts, if there are no watermarks, you're good. For automation, if you don't get the "license not found" error, you're good. But, for automation, this can potentially get tedious.

A quick way to test that a valid Flash Builder license has been compiled into your SWF involves 2 classes, one super secret metadata tag and a trace statement. Check out this simple app to see how this is done (view source is enabled): http://www.flexdevelopers.com/b/swfs/20120103/License.html

1 comment:

licensed builder said...

Thanks for sharing a story about the flash developing. It was informative and worthy reading.