Arrived a bit late today at work (around 11pm) since Ana had to go to the bank in order to do some preparation for our vacation that begins tomorrow. We’re going to Bled in Slovenia for camping, via Venice by airplane.

I wanted to close all my tasks at work before we go and I think I did.

The latest project was really cool to develop. We needed a Flash application with capability to make VoIP calls. I remembered Skype had a developer API and after some digging I ended up coding a simple C# socket server that receives messages from the Flash app and controls Skype accordingly. It works fine and I’ll probably be talking more about it soon.

Another project I had completely wasted me during the last weeks. Fullscreen fluids dynamics just isn’t for Flash yet, even with multicore support. I tryed several ways of applying the “ripple” (andre michelle’s for example) ) but none seemed performant enough to run at 1024×768.

Launching an app with fscommand on Mac OS X

Last week we banged our heads several hours to discover why launching an app with ‘fscommand’ didn’t work on Mac OS X. ‘fscommand’ is an instruction you can issue inside ActionScript code to tell the Flash Player specific instrutions, e.g. to go fullscreen or execute an application. We found [[http://www.actionscript.org/forums/archive/index.php3/t-10928.html|things]] all over the forums but nothing really seemed to work. Today I had a bit more of time to explore this and found the details we were missing earlier. Just remember this works only with a created projector inside the player, not in other modes like debug or test.

First, I created a simple Flash application that only contained a MovieClip named ‘button1’. Then I wrote the code for the onRelease event of the MovieClip as follows:

button1.onRelease = function () {
fscommand("exec", "runthis.app");

Replacing ‘runthis.app’ for the name of the application you want to launch won’t work. Why?

The exec command runs in the subdirectory ‘fscommand’ only. In other words, if you use the fscommand exec command to call an application, the application must reside in a subdirectory named fscommand. So the folder structure needs to be something like this:

"Any name" main folder/
- projector.app
- fscommand/
- runthis.app

Oddly enough, replacing ‘runthis.app’ for the name of the application you want to launch in the new structure also doesn’t work. Is this a bug?

The workaround seems to be creating an AppleScript that simply calls the application you want to launch. I was a bit disappointed when I found this because I wanted a simple way to do this, not another programming language to learn. But as soon as I realized how easy it is to create such a script I laughed. An explanation follows.

==== Creating the AppleScript ====

Open up the AppleScript editor.

Press ‘Record’ and then open the application you want to launch.

Press ‘Stop’.

Select ‘Save as’ and choose a name for the script but don’t forget that it has to end with ‘.app’.

The applescript must be saved as an application, set to ‘run only’, and with the extension visible.

==== Remarks ====

Be sure to name your programs right so fscommand can execute them. The exec command can contain only the characters A-Z, a-z, 0-9, period ()., and underscore (_).

Keyphrases: Mac Projector Applescript/FScommand problem