Archive for the 'Flash' 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/

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.

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.

Actionscript 3.0 Gradients and Curves code generator

Now and then, I have to use the drawing API to draw a gradient, or a bezier curve. Every time, I have to dig through the help, to check the meaning of the different parameters, and where they belong in the function call. To make this more easy, I created a little code generator for gradients, and for drawing bezier curves with Actionscript 3.0.

Gradients code generator:

Beziers code generator

flash remoting with SWX and CakePHP

So, you want to learn how to create a sexy blog in flash, creating posts, comments, database storage, …? Are you afraid of spending hours writing complex queries, parsing XML data or writing loads of php files? Don’t be, and see the power of cakephp and SWX combined. CakePHP being a rapid development framework for PHP and SWX, the native data format for the flash platform! Continue reading ‘flash remoting with SWX and CakePHP’

CakeSWXPHP updated to SWX version 1.01

Aral Balkan released SWX version 1.0 a few weeks ago. I finally found the time to incorporate the changes into CakeSWXPHP! The changes include the swxAssembler class (instead of the old swfCompiler) and the rebranded service explorer.

Go to the cakeswxphp page for the latest downloads!

CakeSWXPHP updated to SWX beta 1.3

I took some time updating my cakeswxphp package to the SWX beta 1.3. One of the new features is the new service explorer from SWX.

You can test your cake gateway, pointing your browser to the /explorer/ directory, gateway location being: cake_amf_gateway.php

Go to the cakeswxphp page for the latest downloads!

Enjoy!

call cakephp through swx / amf

As some of you might know, I’m a great fan of the cakephp framework. It is a rapid application framework for php. Cakephp already had a subproject called cakeamfphp. Looking at the code from cakeamfphp, I was able to get SWX running and call the cake controllers as remoting services.

Go to the cakeswxphp page for the latest downloads…

Just copy/past in your cake directory! Gateway locations are:

swx.php (SWX)
amf.php (AMFPHP)
json.php (JSON)

Currently it uses an adjusted version of SWX, based on SWX beta 1.0. I will try to update it to future versions of SWX when I get the time…

More info about SWX and cakephp at:

http://www.swxformat.org/
http://www.aralbalkan.com/ (Aral Balkan, SWX author)
http://www.cakephp.org/

Enjoy!