My first WordPress plugin!

So I released my first WordPress plugin recently called ‘Broadcast MU‘ – Thanks Luke!

Its actually for WordPress MU (Multi-user) and it allows you to post the same post to multiple blogs, you can read up more on it here.

I hope people find it useful and it is a great opportunity for me to learn more about PHP and WordPress MU, it was developed because there was no similar plugin available for WPMU and we needed it for GDNM.org a site I have been managing for UCA Epsom’s Graphic Design: New Media and Graphic Design courses/departments.

HOW TO: Detect operating system in Flash

Using the following if statement you can test which operating system your currently within, great for my current project where the USB memory stick my projector will be running from needs to have 2 partitions and I want to be able to access the assets from the Windows FAT32 partition from Mac OS X’s HFS partition.

if (System.capabilities.os.substr(0, 3) == "Win") {

// Windows code

} else if (System.capabilities.os.substr(0, 3) == "Mac") {

// Mac code

}

This code combined with my previous post’s code allows me to calculate the current path to my resources folder for Windows and if on Mac to simply use a hard coded path as Mac does not have random drive names, it uses the standard of /Volumes/disk name.

HOW TO: Find the path to the location of Flash projector (Win + Mac)

This snippet of code can be put in the main flash projector so that any loaded swf files can find their way home….

var path = "";
var currentPath = _root._url.split("/");

for (i = 0; i < currentPath.length; i++)
{
	if (i != (currentPath.length - 1)) path = path + currentPath[i] + "/";
}

The code simply gets the _root._url and splits it everywhere it finds a forward slash and puts it all back together again skipping the last part of the url (the filename) its a simple bit of code, could be better written by searching for /*.* using a search pattern but it works and it only has to run once if you run it in an if statement….

if (_root.path == "") {
// CODE
}

I am using this code for a project where we need to have a USB flash drive with two partitions, one for Mac, and one for PC, the PC one will have all the assets (SWF files) and the Mac one will just have a flash projector which points to “files:///Volumes/Memory stick name”. The windows partition will need to have the above code so it knows where to look for its files as Windows assigns a random drive letter where as the Mac uses the “/Volumes/Memory stick name” which unless renamed should remain the same.

The need for two partitions came as for Windows we will have an autorun.cfg file to launch the projector but on Mac this is not possible so the user will open the Finder window and because that partition of the drive is formatted for Mac it will remember the layout allowing us to setup a custom logo, and layout which will be more user friendly than a list of files.