Archive for distribution

Code distribution strategies

Posted in Actionscript, AIR, Development, eclipse, Flash Extensions with tags , , , , , , , , , , , , on December 11, 2009 by andkrup

With the 4th version of Adobes Creative Suite (CS4), it is very easy for developers to manage code distribution.

The SWC code component

Using the compc compiler from any Flex SDK, you can create a swf code library file (a compiled zip file, containing your compiled classes in an swf file + an xml file describing the contents of the zip file). This shouldn’t be any news for the experienced flash developer.

Distribution

Managing and distributing swc files is easier if you use some of the tools also provided by Adobe CS4, but first lets talk about what kinds of issues we have distributing code library files.

Ease of installation

It is much simpler to click once on a mouse button than it is to follow a lengthy set of instructions. Technical people, such as developers are more or less used to follow a step-by-step guide so we might be inclined to issue step-by-step instructions that really only help to scare non-technical people away.

A similar problem is when you want to update.

Ease of everyday usage

Working with AS3-based projects, developers have it easy with Version Systems, and if everybody in the shop knows how to work with the chosen VS, code distribution and updates aren’t really an issue.
Working with designers, externals and other kinds of people might put up some restrictions in that you can’t trust people to know how to work with the VS. This means that you must find another way to distribute your code library.

MXP Flash extension files

Bold designers usually have some experience downloading and installing extensions and Adobe has put a lot of work into the extension architecture, so devising a strategy upon the mxp file seems a good idea.

Distribution Strategy

The main strategy is this:

  1. Create the Extension so it contains all the functionality required for people to use the code library and some easy ways to do it (for instance; a JSFL script that inserts the path to your swc file in the current *.fla file in the flash IDE).
  2. Deliver the Extension online.
  3. Facilitate an easy way for users to get update announcements.

1. Creating the MXP extension

MXP Extension files can be made easily with the Adobe Extension Manager2. You can google tutorials on how to create MXP flash extension files, if you don’t know how.

The important part is the <files /> tag. This is where the meat of your extension is.

My best take on what file locations are good to use atm are the Flash configuration folder which you can refer to by using the ‘$flash’ template-variable:

<file source = "as3codelibrary.swc" destination = "$flash/Libraries" shared="true"/>

This will install your swc file ‘as3codelibrary.swc’ into the end-users Flash config folder: (OSX) /Users/<user>/Library/Application Support/Adobe/Flash CS4/en/Configuration/Libraries/as3codelibrary.swc, (XP) C:\Documents and Settings\<user>\Local Settings\Application Data\Adobe\Flash CS4\en\Configuration\Libraries\as3codelibrary.swc.

The Configuration folder is really a mess and if anyone knows of any guidelines as to how to treat these sub-folders, please share.

Along with the swc file I also put a JSFL script enabling the user to add the swc into the compile-path of the current *.fla file. This is quite simple:

var myDoc = fl.getDocumentDOM();
myDoc.libraryPath = "$(UserConfig)/Libraries;" + myDoc.libraryPath;
fl.trace("library paths: "+myDoc.libraryPath);
(Notice that in JSFL, we can refer to the end-users Configuration folder by the variable $(UserConfig))

This file goes into the end-users Commands folder:

<file source = "jsfl/<jsfl filename>.jsfl" destination = "$flash/Commands/" shared="true"/>

, and will be available in the ‘Commands’ menu in the Flash IDE after it has been restarted.

2. Deliver the MXP extension online and facilitate updates

If you have ever tried to use Badger to distribute Adobe AIR applications and/or the ApplicationUpdater AIR packages, ou know how convenient it is to distribute applications online.

The basic idea is to do something similar. If you are a gamer and know Valves Steam application, you can catch my drift.

Steam is a small client that receives information about available content from the Valve servers and compares that information with already installed content.

Creating a small content distribution system that can monitor the status of installed extensions and notify the user if newer versions have been uploaded online is very similar.

This is possible because the Adobe Extension Manager saves copies of installed mxp files + a copy of the MXI file that was used to create the mxp file in a folder similar to the Configuration folder. AIR allows us to access the filesystem and parse the mxi-file for version data.

Have a look in the “Configuration/Extensions” folder: (Mac OS X) /Users/<user>/Library/Application Support/Adobe/Extension Manager2/Configuration/Extensions

Advertisements