Random techie babbling...

Flosc AS3 Classes

Flosc (Flash Open Sound Control) is a project by Ben Chun that looks like it’s been around for a while but I’d never heard of until I had call to use it in FWiidom.

In fact I’d never heard of Open Sound Control either, but apparently it’s intended as something akin to clunky old MIDI, but over TCP. Flosc is a little Java server that sits and intercepts OSC packets and turns them into Flash XML packets. The classes in the zip below will allow you to connect easily to the Flosc sever and send and receive events and data to any connected OSC device.

I was using these classes for two way communication between Flash and Glove Pie (and thus the Wiimote) and it all worked fine. In theory you should be able to control any OSC device, including some pretty cool sound kit such as MaxMSP or Traktor.

>> Download Flosc AS3 Classes <<
This zip just contains the new AS3 classes, you’ll still need to get the main Flosc files.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.


Got something to say? Feel free, I want to hear from you! Leave a Comment

  1. joshua noble says:

    Wow. Excellent. I was using FLOSC to communicate with a MakeController and I was a little bummed out that it was still in AS3. Thanks for the work!

  2. Barrow says:

    Awsome download, ive been looking for something to do this for ages. Thanks a lot

  3. satcy says:

    Nice works.
    I test these classes. then “parseXml” function cant parse “int” type data.
    –if (type==”i”){….}

  4. John Barton says:

    I’ve been one of the peeps using your AS3 classes with the Make Controller. I just wanted to let you know that I’ve been writing a series of articles that use those classes – so thank you for coding them up. I have also found a bug when using them with the Make Controller. Check out http://phy5ics.com/blog/2007/07/26/getting-started-with-as3-and-the-make-controller-part-2-let-the-hacking-begin/ for details and let me know if there is anything I can contribute.

  5. Andrei Thomaz says:


    I’m afraid I’ve found a bug in your code. The AS3 reference (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/) says that XMLSocket.connect() returns void, but, on line 40 of OSCConnection.as, you evaluate the value returned by connect(). If I’ve understood well, you should catch the errors thrown by connect(), but not evaluate its result.

    I’ve found this problem because I was always getting an ON_CONNECT_ERROR event, despite the connect being properly established. Ignoring this error worked for me, but I don’t think this is the best procedure.

    Anyway, thanks for your code. And I’m also surprised that Flash CS3 generates no error or warning for line 40.

    best regards,

  6. oldskool73 says: (Author)

    Hey Andrei,
    I’ve not updated these for a while, you may want to take a look at John’s site, a few guys there were fixing up a whole pile of my stupid bugs :)


  7. seth says:

    I found a bug in the Send OSC Packet. FLOSC expects the arguments to be in this order: TYPE then VALUE – so you have to replace your code with this:

    for (var i:Number=0; i

  8. aymeric says:

    I can’t make the java gateway work on Windows Vista. Typing java Gateway 7000 3000 in the DOS prompt gives me an error :

    D:\LIVE\Woui\FLOSC\flosc-0.3.1\flosc-0.3.1>java Gateway 7000 3000
    Exception in thread “main” java.lang.NoClassDefFoundError: Gateway
    Caused by: java.lang.ClassNotFoundException: Gateway
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)

    I have tested it on Windows XP and it works !
    Would you have any idea on how to make this work on Vista ?
    thanks for any suggestion.

  9. Jelani says:

    Thank you thank you thank you for this! I have been banging my head against a wall for a couple weeks trying to get max/msp to talk to flash through flosc and all the tools, tutorials, examples I found were for as2 and I couldn’t get as3 to see & process the osc packets. I wrote a test file in as3 using your OSC classes and it works! cheers

  10. nano says:

    FYI – the FWiidom as3 code doesn’t work with integer data type.

    modified OSCConnection.as line 113 to include:

    if (type==”i” ) {

Trackbacks for this post

  1. Using Flash for MIDI « boringBlog
  2. ShredBoard | bruzed.com

Leave a Comment

Let us know your thoughts on this post but remember to place nicely folks!