RIA + OSP = RAA || REA && And how to detect an Open Screen Device

Keeping with the algebraic/code functions as titles from my Last post I thought I would put some thoughts down regarding the news from Adobe earlier this week of their Open Screen Project (OSP). Anyone working in the Web/Internet industry at the moment will be well aware of the Rich Internet/Interactive Application (RIA) moniker. What Adobe is committing to is much larger though this is about true cross platform convergence. Its about Rich Anywhere Applications (RAA) or Rich Everywhere Applications (REA) if you will. You see what I did there 😉 .

Interestingly this is a concept I began to scratched the surface of with my presentation at Flash On the Beach Last Year, and over the last few months has been a subject I have continued to keep close to hand both in my day job and my personal development projects. At the moment the Flash Player Fragmentation offers a considerable challenge to any developer wanting to design and or develop for multiple devices and multiple screens.

Articles like the one posted over at ADC on adaptive screen layouts offer a great foot up. But before we get to visual display we need to know what player version we are targeting. And to do that, we have to hit the time machine button and roll back all the way to Flash 4…..

The Following code should be exported as a Flash 4 ActionScript 1 .swf. This will ensure it can run on the broadest client base. The resultant .swf acts a cross platform redirect that should work within both stand alone and browser based flash clients. Once the .swf loads it will identify the player variation and then redirect the viewer to the appropriate content for there player platform by loading a replacement content swf at the main player level.

/**
Declare flash platform player strings here. As more devices are discovered this list will grow, the strings are from the getVersion() function
*/
// FlashLite 1.1 player platform string
FL1PLATFORM = "5.2";
// FlashLite 2 or 3 player platform string
FL2PLATFORM = "FL ";
// psp Flash Player Platform string
PSPPLATFORM = "NF3";
// Wii Player Platform String
WIIPLATFORM = "WII"
// windows Flash Player Platform string
WINPLATFORM = "WIN";
// mac Flash Player Platform string
MACPLATFORM = "MAC"
/**
Declare files names for flash files of different device configurations
NOTE! Include the full path name here
*/
flashLite1 = "fl_fl1.swf";
flashLite2 = "fl_fl2.swf";
flashLite3 = "fl_fl3.swf";
flash6PSP = "flash6PSP.swf";
flash7WII = "flash7WII.swf";
flashFull8 = "FullFlash8.swf";
flashFull9 = "FullFlash9.swf";
// get the player version
flashVersion = getVersion();
// display full player information
trace(flashVersion);
// test for existence of player version for very early players
if(flashVersion == "")
{
	/*
	Player does not support $version so is VERY early Flash PLayer
	Decide how you wish to handle this case here
	*/
}
// crop the player version to store the platform
playerPlatform = substring(flashVersion, 0, 3)
// Assign a player version for testing
// playerPlatform = PSPPLATFORM;
// display platform information
trace("playerPlatform");
trace(playerPlatform);
// use flashLite 1.1 file
if(playerPlatform eq FL1PLATFORM)
{
	// launch a FlashLite 1.1 version of the file.
	trace("Launch FlashLite 1.1 player version");
	loadMovie(flashLite1, "_level0"); //+"?stgWidth="+Stage.width+"&stgHeight="+Stage.height);
}
else 
{
	if(playerPlatform eq PSPPLATFORM)
	{
		// launch a PSP or Flash 6 version of the file
		trace("Launch PSP player version");
		loadMovie(flash6PSP, "_level0"); //+"?stgWidth="+Stage.width+"&stgHeight="+Stage.height);
	}
	else if(playerPlatform eq WIIPLATFORM)
	{
		// launch a PSP or Flash 7 version of the file
		trace("Launch WII player version");
		loadMovie(flash7WII, "_level0"); //+"?stgWidth="+Stage.width+"&stgHeight="+Stage.height);
	}
	else if(playerPlatform eq FL2PLATFORM)
	{
		// grab the player version number for flash lite
		playerVersion = substring(flashVersion, 4, 1);
		// display version information
		trace("playerVersion");
		trace(playerVersion);
		if(playerVersion == "7")
		{
			// launch a FlashLite 2 version of the file.
			trace("Launch FlashLite 2 player version");
			loadMovie(flashLite2, "_level0"); //+"?stgWidth="+Stage.width+"&stgHeight="+Stage.height);
		}
		else if(playerVersion eq "8")
		{
			// launch a FlashLite version of the file.
			trace("Launch FlashLite 3 player version");
			loadMovie(flashLite3, "_level0"); //+"?stgWidth="+Stage.width+"&stgHeight="+Stage.height);
		}
	}
	else if((playerPlatform eq WINPLATFORM) || (playerPlatform eq MACPLATFORM))
	{
		// grab the player version number for desktop player
		playerVersion = substring(flashVersion, 5, 1);
		// display version information
		trace("playerVersion");
		trace(playerVersion);
		if(playerVersion == 8 )
		{
			// launch a desktop version 8 of the file.
			trace("Launch desktop player version");
			loadMovie(flashFull8, "_level0"); //+"?stgWidth="+Stage.width+"&stgHeight="+Stage.height);
		}
		else if (playerVersion == 9 )
		{
			// launch a desktop version 9 of the file.
			trace("Launch desktop player version");
			loadMovie(flashFull9, "_level0"); //+"?stgWidth="+Stage.width+"&stgHeight="+Stage.height);
		}
	}
}
stop();

The below zip includes the full source and example ‘redirection’ movies. If you have any other Client version strings that can be added please let me know and I will try and keep the script updated. For example I would love to know what the Sony Ericcson Java client version reports.

Identiying Flash Client Versions

Leave a Reply

Your email address will not be published. Required fields are marked *