Archive for ActionScript

Using RFID in an ActionScript Application

In order to receive tags, the RFID reader has to be activated through a click on the image. After that, the different RFID tags (sorry for my tiny tags) are used to create different forms.

Read more »

Digital Graffiti – A Subculture Conquers Interactive Worlds

Finally I delivered my thesis project I did in cooperation with Less Rain. The subject was »Digital Graffiti – A Subculture Conquers Interactive Worlds« and it’s all about experimenting with different input devices for a physical, digital graffiti installation. The result is an Adobe AIR application using either the computer mouse, the Nintendo Wiimote or »VandalSpray« to paint digital canvases. VandalSpray is a digital spray can specifically designed for this purpose. It implements the attributes of a real spray can or at least trys to achieve them as natural as possible. Except a turnable bottom for changing the color, VandalSpray has no other interfacing elements than its real counterpart and therefore you don’t have to learn and explore the functionality first, because you intuitively know how to use it.

VandalSpray features includes:

  • exchangeable caps
  • color display
  • digital valve system to vary the amount of »paint« coming out of the cap
  • different colors
  • wireless

The spray can is built upon the Arduino platform and uses different sensors and electronic modules like a RFID reader, a super bright RGB LED, a Rotary Encoder, a Bluetooth module, a force sensitive resitor (FSR) and loads of wires and solder to implement the desired behavior. For tracking the spray can I use a Wiimote and the WiiFlash ActionScript 3 library and server, but this could also be replaced by a standard webcam and an adequate tracking implementation.
Because I didn’t want to put some kind of speaker in the spray can (there was no space left anyway) the spray sound is generated from the AIR app and output on the speakers of the notebook.

VandalSpray vs. Montana spray can

VandalSpray electronics

More
http://blog.formatlos.de/2008/12/12/digital-spraycan-edemo/
http://blog.formatlos.de/2008/12/19/digital-graffiti-spray-demo/

FlashPlayer 10 and loading AVM1 content

I’m using some swf assets directly exported from Illustrator CS3. You can export Flash 9 swfs, but as you can’t add any code there you will always get AVM1 content (AS2.0). So it’s basically just an information in the header and maybe Adobe will put an option in the export-settings to actually publish AVM2 swfs. I haven’t tried CS4 so far, maybe it’s in there already?!
Anyway, loading this swfs and moving it to another part of the displayList didn’t cause any problems using FlashPlayer 9. In FlashPlayer 10 I get the runtime error 2180:

Error #2180: It is illegal to move AVM1 content (AS1 or AS2) to a different part of the displayList when it has been loaded into AVM2 (AS3) content.

There are a few options to avoid this error:

  • Don’t load AVM1 content respectively create the assets in Flash to get AVM2 swfs
  • Don’t move the assets in a different part of the displayList
  • Change the SWF header on-the-fly

The last solution seemed to be perfect and remembering the AVM2Loader class someone created in the upcoming AS3 times it was the easiest solution without changing the workflow. Even if the author Fladdict removed the class, you can still find it on the internet at Troy Gardners blog.

Update 20.11.2008

To use this workaround in an AIR application you have to set allowLoadBytesCodeExecution = true in your LoaderContext otherwise you aren’t allowed to load the bytes of the swf.

...
var loader:Loader = new AVM2Loader();
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.allowLoadBytesCodeExecution = true;
loader.load("file.swf", loaderContext);
...

AIR 1.1 – hiding the mouse cursor

Adobe AIR is out quite a while now and you might think that at least all the functions being in the FlashPlayer for years are implemented correctly. Obviously this is only wishful thinking because I wasn’t able to hide my mouse cursor through Mouse.hide() even though the documentation says that it’s possible. I couldn’t reproduce the same thing on Windows so I guess it’s only a problem on OSX and maybe Linux (but who really cares about linux?). After investigating quite a while I found out that the cursor disappears after moving it out of the window and back in or switch to another application and back but you can’t tell the user "please move your cursor out of the window and back in" or at least it’s not very nice and user-friendly. I tried every possible setting for the native window and finally found a workaround … wohoo.

Try the following in your document class and your cursor is gone, hopefully!

stage.nativeWindow.activate();
stage.nativeWindow.orderToBack();
stage.nativeWindow.orderToFront();
Mouse.hide();

Basically this sends the window behind all the other windows and brings it to the front again immediately. You won’t see the change or any flickering. After that you can hide your cursor.

Update 17.11.2008

Adobe just released AIR 1.5 but seems like this problem is still there. The workaround is still working so keep on rockin’ or should I say hiding

AIR 1.1 – Maximized Window at Startup

There are a lot of settings for the initial window in the application descriptor file but none for getting a maximized window at startup. To achieve that you have to call stage.nativeWindow.maximize() in your Document Class. This works fine but you’ll actually see the small window being maximized and this isn’t very cool. To avoid this you can set visible = false for the initial window in the descriptor file and show the window after maximizing it but take into account that the maximize() method is asynchronous and therefore setting stage.nativeWindow.visible = true right after the call won’t change anything. Use the NativeWindowBoundsEvent.RESIZE event to determine when your window size has changed.

...
public function Main()
{
	stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, resize);
	stage.nativeWindow.maximize();				
}
private function resize(event : NativeWindowBoundsEvent) : void
{
	// show window + set keyboard and mouse focus
	stage.nativeWindow.activate();
}
...

Apparently this works on OSX but not on Windows. There the window has to be visible in order to maximize it. I didn’t do many tests so prove me wrong if you have other experiences.

« Older Entries

Newer Entries »

About

Martin Rädlinger is an Interactive Developer & Designer. He specializes in interactive coding predominantly with ActionScript, but every new challenge is welcome. If you like his work feel free to get in touch with him. At the moment he's available for freelance work.

Contact

Martin Rädlinger
mail: mr [at] formatlos.de
web: www.formatlos.de
xing: Martin Rädlinger
linkedin: Martin Rädlinger
skype: martinraedlinger