Archive for the 'Actionscript 3.0' Category

websocket version 8 support in AIR Server

It’s been a while since my last update on AIRServer – an actionscript library which enables you to set up a socket server in Adobe AIR, which listens to multiple socket inputs (native AMF sockets, websockets and P2P input).

Some of my students noticed the websockets didn’t work in the latest versions of Google Chrome. This is because Google chrome uses another version of the websocket protocol. If you enjoy reading specs, you can find it at http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10 :-)

Anyway, took me quite some work, but I finally got it working. I was able to port some of the code of the Bauglir Internet Library (http://www.webnt.eu/index.php) to actionscript. AIRServer now supports both hybi-00 and hybi-10 of the protocol.

You can download the updated library and demo’s here. Enjoy!

Update on http://blog.aboutme.be/2011/12/23/airserver-0-5-socket-byte-concatenation/

Linking Microsoft Kinect SDK to Adobe AIR & TUIO Multitouch

Finally had a chance to play around with the official Kinect SDK. First thing I wanted to try, was to link the Kinect SDK to Adobe AIR (with UDP), and adjust my previous kinect demos (with OSCeleton and the open source drivers) so I could do multitouch with the kinect (a bit like minority report). The official SDK is a lot more stable then the open source drivers, and another plus is you don’t need to stand in a calibration position for the skeleton to get tracked. Downside of the official SDK is that it’s windows only…

So, I booted up my Windows pc, and threw together a UDP bridge in C#, which sends the skeleton information as a JSON encoded string to a target IP + port. I’ve coded a little adapter in Actionscript 3, which translates the JSON object into TUIO cursors. After that, it was a piece of cake to get multitouch working in Adobe AIR, using the skeleton information from the kinect.

Using your hands as multitouch cursors

I’m happy to share the C# project for the Kinect UDP bridge, and an AIR sample project, which allows you to transform a square, using the touch events from the kinect. Have fun!

Update: I’ve also uploaded a binary, run setup.exe in the zip file to install. Make sure the kinect is connected when you start up the application.

Source code for airserver space game

Sorry for neglecting this follow-up post, but here it is: the source code for the airserver space game from my previous post.

The zip file is actually a Flash Builder 4.5 workspace, containing the following projects:

- AIRServer: the library project containing the AIRServer classes
- CocoonP2P: the cocoon P2P library
- DevineSpaceGameAIRServer: the AIR server, containing the space game
- DevineSpaceGameControllerAMF: A mobile controller, using an AMF socket connection
- DevineSpaceGameControllerP2P: A mobile controller, using CocoonP2P

When the game is running, you can control it through websockets aswel: surf to http://labs.aboutme.be/airserver/spaceshooter/ with an iPhone4 / iPod Touch 2 or iPad to control the game.

Enjoy!

AIRServer example: multi-user smartphone controlled game

I wrote this game on top of my AIRServer library, as part of some multi-user explorations with the flash platform. The graphics were created by my HOWEST colleague Jynse Cremers :-)

Users can join a 30-second spacegame. Each user controls a spaceship with their smartphone. The game itself was built with Adobe AIR and the AIRServer actionscript library. To join the game users can choose between a native application built with Adobe AIR, or an html5/js websockets client in their browser.

I’ll release the source files after some cleaning up, so you can play around with it aswell!

Update: find the source files in the follow-up post!

Smartphone controlled game on Vimeo.

Communicating between websockets, local P2P, flash sockets & AIR

I’ve shown you how to handle websockets in adobe air, and how to set up communication between flash sockets, websockets and adobe air using a library I wrote. I’ve extended the library with support for local P2P, using Cocoon P2P.

airserver-sockets-websockets-rtmfp

Continue reading ‘Communicating between websockets, local P2P, flash sockets & AIR’

AIRServer – handling both sockets & websockets in Adobe AIR

In my previous post, I talked about how to handle websockets in Adobe AIR. I’ve written a library around it, which makes it easier to implement in your projects. Another benefit of the library, is you can combine websockets with regular sockets, so you’re able to talk between Adobe AIR, websockets and flash sockets.

AIRServer Messages Demo

Continue reading ‘AIRServer – handling both sockets & websockets in Adobe AIR’

Handling websocket connections with Adobe AIR ServerSocket

Since Adobe AIR 2.0, you can create your own socket-servers, using the flash.net.ServerSocket class. This makes it easy to hook external applications to your AIR applications, for example to create a game (server) with multiple devices as game controllers (socket clients).

Continue reading ‘Handling websocket connections with Adobe AIR ServerSocket’

as3osceleton: Using Kinect as a multitouch device in adobe AIR

After buying an XBox with a kinect sensor, noticing that there is no way to attach it to your computer when you buy the bundle, and buying a standalone kinect sensor afterwards, I looked into getting the kinect data into my flash / AIR applications.

Continue reading ‘as3osceleton: Using Kinect as a multitouch device in adobe AIR’

Flash – HTML5 Drag and drop integration

After seeing Mario Klingemann’s HTML5 drag and drop demo, I wanted to write a library around it and make it a little more cross-browser.

Register the necessary event listeners to the class and react to events such as dragging a file / element over your swf, dropping data or dropping a file on the swf.

FlashDragDrop.addEventListener(FlashDragDropEvent.DROP_DATA, dropDataHandler);

You don’t need to add any extra javascript to your flash embed, the javascript necessary to add the drag and drop support is injected automatically.

You can detect the drag and drop events in the latest versions of Firefox, Safari and IE. Accessing the content of the dropped files only works in the latest version of Firefox (try dropping an image).

You can check out a demo or download the source files.

Webcam Difference Keying

Some of my students are working on a project where they need a photo-booth-like keying application (take snapshot with somebody out of the picture, then step back in the picture and the background disappears). I’ve been experimenting with pixelbender the last week, and created some classes that do just that.

difference_keying

Check out the example, and play around with the parameters. Please note that it works best with a background without too much detail or similarities with the person in front. Also make sure there’s enough lighting.

You can download the source files and play around with them.