Read flashlog.txt using AIR2 and NativeProcess

I’m sure you know by now that the Flash Platform is a great choice for making great front end applications to databases, or web services.  However, did you know with the release of AIR2 you can now use Flash or Flex to make gui front ends for existing programs or processes on your machine?  That’s right, AIR2 brings us a new feature called NativeProcess which let’s you communicate with existing programs or processes running on your machine.

Native Processes: Launch and communicate with native “out-of-band” processes. Bundle your own native executables, or call executables that you know are already on the machine. This feature requires that your application be installed with a native installer rather than though a .AIR file (we provide tools for building native installers).

  • Types of installers:
    • OS X: DMG
    • Windows: EXE
    • Linux: Debian and Red Hat Package Manager

See Christian Cantrell’s blog for the rest of the AIR2 new feature list.

I really enjoy building small apps for myself that are either fun or help with workflow.  Recently I was on an HTML5 project that required me to upgrade all my browsers to the absolute latest versions.  Well when I upgraded Firefox to 3.6, I could no longer use my Flash Tracer add-on, which caused a big workflow issue with my current Flex project.  While I know there are plenty of debug alternatives to Flash Tracer, I thought this would be a perfect chance to take AIR2’s NativeProcess out for a spin.  It also gave me a simple demo app for my talk at 360Flex about AIR.

So here’s what the simple logger app looks like.

AIR2's NativeProcess allowed me to build a simple flashlog.txt readerWith AIR2’s NativeProcess, you can build all sorts of cool new AIR apps like a flashlog.txt reader

Now that you’ve been blown away by my design skills, let’s walk through what, how, and where to get this app.


AIR2, cross platform ( mac, win ), flashlog.txt reader.


Cross Platform – to take advantage of NativeProcess, your application must be installed as a native installer.  After you build your application, when you export the release build you select native installer instead of .air file.  When building AIR apps that you want to export as a native installer, you must build your application on the correct platform.  That is, I can’t build the .exe of this application on OS X, only the .dmg installer.

If using NativeProcess, export native installer instead of .AIR

FlashBuilder option for native installer is in export release dialog

Since this app is so small I had no problem storing the OS X and Windows specific code in the same place.  When the app is run I use flash.system.Capabilities.os to determine Windows or MAC.  I know the path to flashlog.txt is now hard coded into Flash Player, but I still have to build the platform appropriate path to flashlog.txt.

MAC – /Users/{username}/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt

WIN – C:Users{username}AppDataRoamingMacromediaFlash PlayerLogsflashlog.txt

To grab the current username I parsed the results of File.userDirectory.url.  The last piece to setup is the path to the executable used by NativeProcess.  On OS X I’m using tail, which lives at /usr/bin/tail.  For Windows7, Powershell should live at C:WindowsSystem32WindowsPowerShellv1.0powershell.exe.

TIP : On OS X, you can use the “which” command to locate a program ( EX : which tail ).  On Windows, use the “where” command to locate a program ( EX : where powershell.exe ).  You will want to know this if the paths in this app doesn’t work for you.

Read flashlog.txt – to read flashlog.txt on OS X I’m using NativeProcess + tail.  On windows I’m using NativeProcess + Powershell’s Get-Content cmdlet.  Now that we know platform and paths, it’s time to setup our NativeProcessStartupInfo which will contain the executable we’re going to use, plus any required arguments.  In order to setup your NativeProcessStartupInfo object, you will need to know how to use the nativeprocess via command line first.  Using OS X’s tail as the sample, you can read the contents of flashlog.txt by running this in Terminal.

tail -f /Users/{username}/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt
tail -f shows you the contents of a file as it changes

I can run tail in Terminal, or in an AIR application using NativeProcess

Here is the equivalent AS3 setup for running the same command via NativeProcess.  The executable is set to a File which points at tail.  The arguments required by tail are stored in a Vector<String>.

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = new File(&quot;/usr/bin/tail&quot;);

var processArgs:Vector.&lt;String&gt; processArgs = new Vector.&lt;String&gt;();
processArgs.push( &quot;/Users/&quot;+user+&quot;/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt&quot; );

nativeProcessStartupInfo.arguments = processArgs;

Now that the startup info is set, it’s time to setup our NativeProcess listeners, then start the process.

var process:NativeProcess = new NativeProcess();

// add listeners
process.addEventListener(NativeProcessExitEvent.EXIT, onNativeProcessExit );
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onStandardOutput );
process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, onStandardInput );
process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError );
process.addEventListener(IOErrorEvent.IO_ERROR, onIOError );


And that’s all there is to it, the important bits of reading flashlog.txt using AIR2’s NativeProcess.  NativeProcess has me excited because it opens a whole new world of apps that can be built.

I wrote this app for personal use and my 360Flex talk.  If you have interest in seeing more AIR2 samples, have a look at  I put together a bunch of links supporting my talk on HTML and AIR which should keep you busy for a while.


Contents of

Click me to download the full source AIR2BUGGER


360 Flex, HTML5, Adobe AIR, and a bathrobe

I’m happy to share my 360 Flex presentation on HTML5 and Adobe AIR.  This is a topic I have a renewed interest in after Steve Jobs decided to start a war against Adobe’s Flash player.  Also, my very first major HTML5 project was launched the week before 360 Flex.

Despite the title of this presentation, I didn’t put this together to bash HTML5 or Apple.  Steve Jobs fired me up when he declared Flash dead, and I realized it’s time to start having the “technology is a tool” conversation again.
Bottom line, know your problem so you can pick the appropriate tool for the job.  That tool might be HTML, it might be the Flash Platform, or it may be Lego blocks.  Chances are your target customer doesn’t care.
If you have any interest in the sample AIR applications I demoed, just drop me a line, comment, email, tweet, smoke signal, or carrier pigeon.

View more presentations from Eric Fickes.
BTW, I gave this preso wearing a bathrobe.
I like to be comfy when I speak
* this was posted from the backseat of @thecompilers mini van while driving home from 360 Flex. We’re currently heading west on I70 ( Go go Sprint 4G! )

I am going to 360 Flex DC, and so should you

I’m happy to announce I received my Golden Ticket to speak at the next 360 Flex conference in Washington DC.  The conference will be held at the Hilton DC North Gaithersburg, September 19 – 22, 2010.

I am speaking at 360 Flex DCI’m going to 360 Flex DC, and so should you

I spoke at the last 360|Flex in San Jose, but I’m already more excited for the DC conference, and here’s why.

  1. I’m speaking about the most exciting part of the Flash Platform, AIR2
  2. Jesse vs. Jesse ( Flash vs Flex throwdown )
  3. It’s in Washington DC
  4. My band The Compilers will be giving a lunch talk, as well as playing live at one of the parties
  5. There is talk of Duanne Nickull’s band 22nd Century playing ( hopefully Sean ‘the flex guy’ too )
  6. Doug McCune is giving the opening Keynote speech on Monday
  7. I get to hang out with the Flex community

If you haven’t been to a 360 Flex conference yet I highly recommend it.  If you still need help deciding, here are a few conference questions for you.

  1. Do you currently work with or have any interest in Adobe Flex?
  2. Have you attended a 360 Flex conference yet?
  3. Do you want to meet the community loudmouths you’re already following on Twitter?
  4. Have you seen who is speaking at 360 Flex DC?
  5. Have you ever heard The Compilers play live?
  6. Are you still reading this blog post?

The last 360 Flex I spoke at was in San Jose and it rocked.  The city of San Jose bored me to tears, but I felt like I was living inside my twitter feed for three days.  My presentation was on the final day of 360 Flex, so I spent most of the conference preparing, and sitting in a few sessions here and there.  I spent almost half of my time in San Jose working and still met 10-15 of my twitter buddies, not to mention all the new contacts I met.  In a nutshell, if you attend a 360 Flex conference, you will meet the community.  In fact, you’d have to try pretty hard to not meet the Flex community.

If this sounds up your alley, go ahead and register to take advantage of the early adopter ticket price of $450.  I’m not sure when the ticket price will go up to $599, but I know it will so act fast.  If you make it to DC, be sure to find me and introduce yourself.  I promise it will be a good time.

360|Flex Washington D.C. Sept.19-22

Early adopter price $450

360|Flex Information





It’s official, The Flash Platform rocks!

* UPDATE : all the videos were originally made and hosted at which is now defunct.  I will get these videos updated someday.  Sorry for the loss.

In case you missed the June RMAUG meeting, my band The Compilers played our first hybrid concert and presentation show. Who are The Compilers? As far as I know, we’re Denver CO’s only Tech Funk Fusion trio that use internet technology along with analog instruments. By day we’re internet programmers, and by night we’re rockers. Right now majority of our software revolves around the Flash Platform, so it was only natural that we play at RMAUG.

Below is a recap of our setlist, and notes about the technology we presented on. When you see mentions of a Flash movie, these are not run as standalone SWF files. They are actually played by our Flex based Compilers Live Player. This application runs on our guitarist Jun Heider’s laptop, and the entire app is controlled over MIDI, via a Behringer FCB1010 Foot Controller, MMJ, and MERAPI.

Intro Song

For the first song of our set we decided to use a funny and informative Flash movie to give the audience a hint at what they’re about to see. For the June RMAUG show, this movie was updated to include spoken thank you slides for the companies that make our technology, and special shout outs to all the people who help us put on a great show.

Watch Flash Intro Movie

I want an iPhone

For our iPhone song we have another entertaining Flash movie that gets played during my iPhone solo part. Both this song, and the Flash movie where updated a bit for RMAUG. Unfortunately Soundbooth crashed on us when saving the recording of our live set, so I can’t play a clip for the remixed iPhone song, but you can watch the updated iPhone Flash movie.

Watch Flash iPhone Movie

All your base, are belong to us

This song is pretty straight forward when it comes to technology. We have a backing Flash movie that plays scenes from the ZeroWing video game, as well as the ‘All Your Base’ iPhone app for ZeroWing audio samples. I’m not including anything for this song besides, if you’ve seen us play before, this song now has a reggae feel to it. Prior to this show, ‘All Your Base’ was a hard driving all your punk are belong to us.

Sleep Tick

This is one of our original rock tunes which has been given a minor touch of technology. There is a middle part that I now break out into an iPhone solo, and we also have an AIR 2 powered audio visualizer. This particular app is one of the most exciting for me because I’ve been waiting for the day when we can use getMicrophone to pull raw data. Instead of explaining this one, you can watch it instead.

Tweet Jam v2

I’m happy to report our crown jewel of internet technology and audience interaction mashup “Tweet Jam”, has reached version 2. Both the song and the application have been rewritten especially for the RMAUG show. TweetJam is an instrumental jam song where the audience tweets at @thecompilers during our show, then our Roboreader application imports the @mentions and reads them back to the crowd via robot voice. Since our application reads the live Twitter feed, you don’t have to be at our shows to participate! A final point of interest for this application is that I run this on my laptop and control it using a wired XBOX 360 controller. There’s not much more to explain, but there is a video showing it in action.

James vs. Rick

Our final song of the night uses two applications. One is a game for the audience, and the other is a simple audio app. The game is an AIR application that connects to the ‘phone game company’ MegaPhone service and displays a specially assigned 888 telephone number, and a range of numbers to press in order to vote for James Brown ( 0 – 4 ) or Rick James ( 5 – 9 ). When a player calls in and presses a number from a specific range, our AIR app will play an appropriate audio sample while we’re playing. Our AIR app keeps track and displays the running vote count, then at the end of the song we fade and play a funny video from the winner.
The second application ‘Funky Funky’ is a simple AIR2 application that uses NativeProcess to say “Funky Funky”. While this doesn’t sound like anything noteworthy, it’s a perfect application for this particular jam because OSX’s SAY command has a voice called “Bells” that speaks in a melody that matches the song we’re playing. Of course this doesn’t make much sense not knowing what the song sounds like, so here’s the actual application for you download and try out. Note, this is an AIR2 app that uses NativeProcess, so this is an OSX only application.
Funky Funky! A text to speech OSX application by The Compilers
For your entertainment, here are two funny videos from James Brown and Rick James.

The Flash Platform Rocks!

So there you go, proof that the Flash Platform rocks! I haven’t thought of any rocking ending other than, go check out AIR2. The Flash Platform is no longer restricted to the browser. Let all the HTML heads keep the browser, I want to rock on stage with Flash.


We didn’t get a recording of the show, but we do have a photo album of the June RMAUG on Facebook.

The Compilers Next Show

If you missed The Compilers at RMAUG, we are playing at Ignite Denver 7 on July 27th. If you can’t make that show, be sure to at least tweet @thecompilers on July 27th to get yourself heard.
Be sure to check out The Compilers World for information from the future of the internet rock trenches.