Change functionality based on flash player type

Usually, when you code, you might find that you need to change a few things in the code based on whether you are working locally or on a web host. For example, suppose you are sending a request to a server side script (emailing for instance) called “email.php”, if you are working from inside flash, then the path to the request will be something like “http://localhost/yourappfolder/email.php” and if it were on a server, it can be just “email.php”.

The problem is that when you are uploading the application to a server, you might have to change all occurences of such code to put in a relative path. This is where I found detecting flash player type to be useful.  Below is the code:

if(Capabilities.playerType == "External")
{
	//do your stuff for local development
}else{
	//do your stuff for running the code when on a server
}

Happy coding! :)

One Response to “Change functionality based on flash player type”

  1. hey, I am a design enthusiast and I think your post is very inspirefull for both rookies and advanced designers. Keep it up!

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes