Categories
Actionscript Flash Multi-Touch

Google Maps Multi-touch App

I’ve built a small Google Maps multi-touch app with Flex and Flash over the last days:

It uses the Google Maps Flash API and the TUIO Actionscript classes and the Touchlib from the Nuigroup.

The red stuff on the screen means that i am using the debug mode of Google Maps for Flash. That is because I execute the Flash file on my local computer. The problem is: For TUIO I need to connect to a local socket. Actually I don’t know how to access a local socket server with a Flash app that opens up in my browser on a remote site (and if this was possible it would scare the hell out of me). Seems like I need to live with the red stuff…

Maybe someone has wondered why I only use the view with satellite pictures. It is also possible to have the maps view but by the time I produced that video the maps servers were offline for a day.

Update: Google Maps Multi-touch Application Actionscript Code

Categories
Actionscript Flash Multi-Touch

A Multi-Touch Photo Browsing Application (with Source Code)

The Touchlib offers lots of Flash related possibilities to build your own multi-touch applications. There are even some demo applications included in the package in the code version of the Touchlib.

Thus I took a demo photo application from them and replaced their Flickr images with mine and exchanged the whole mechanism for dragging and scaling (and left out rotating) for my logic (resp. niqui merret‘s logic).

It’s just a me too photo app but nonetheless here we go:

Update: By common request I have decided to publish the source code: FlickrPhotoApp.zip. I put this code under the Creative Commons Attribution 2.5 License (this means that you can use the code literally for everything but must mention my name).

Categories
Flash Hochschule RheinMain Multi-Touch Visualization

Progress 2nd multi-touch table

My 2nd table now has got a lid and the paintwork has been done (the color is bright white). It looks really professional now. I updated my multi-touch table photoset on flickr:

Small multi-touch table.

Categories
Actionscript Flash

Embed Illustrator Vector Graphics In Actionscript 3

There’s a really cool article about the embedding of resources in Actionscript 3 in Keith Peters bit-101 blog.

If you’re using his technique you can get rid of that awkward Flash GUI and just develop Flash applications with Eclipse in combination with the Flex Builder plugin by Adobe (currently you can obtain a free license for the Flex Builder Plugin as a student) or with the FDT plugin by Powerflasher.

In the beginning you need the Flash GUI to put all the graphical stuff you need in the library of one Flash file each as a MovieClip symbol. Afterwards you export the swf, put it in you main source folder and follow Keith’s instructions.

I use this to embed Vector graphics I get in an Illustrator format from a Designer to embed it as a Vector graphics in Actionscript 3.

Categories
Actionscript Flash

Flash Actionscript 3.0 drawString equivalent [Update]

I’m coming from the Java world where you could ‘just’ draw Strings. However, in Flash it’s not as easy to actually draw a String on the screen.

For that purpose I use following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
textSprite = new Sprite();
 
//automatically shows a hand as mouse cursor when the mouse hovers 
//over the text field
textSprite.buttonMode = true;
 
addChild(textSprite);
var labelType : TextField = new TextField();
labelType.text = "Text in a line.";
labelType.autoSize = TextFieldAutoSize.LEFT;
labelType.wordWrap = true;
 
//copy TextField into a bitmap
var typeTextBitmap : BitmapData = new BitmapData(labelType.width, 
                                labelType.height,true,0x00000000);
typeTextBitmap.draw(labelType);
 
//calculate center of TextField
var typeTextTranslationX:Number = -0.5*labelType.width;
var typeTextTranslationY:Number = -0.5*labelType.height;
 
//create Matrix which moves the TextField to the center
var matrix:Matrix = new Matrix();
matrix.translate(typeTextTranslationX, typeTextTranslationY);
 
//draw invisible rect in the background that will serve as click area
textSprite.graphics.beginFill(0xfff0000,0);
textSprite.graphics.drawRect(-0.5*labelType.width,-0.5*labelType.height, 
                                labelType.width, labelType.height);
textSprite.graphics.endFill();
 
//actually draw the text on the stage (with no-repeat and anti-aliasing)
textSprite.graphics.beginBitmapFill(typeTextBitmap,matrix,false,true);
textSprite.graphics.drawRect(typeTextTranslationX, typeTextTranslationY, 
                                labelType.width, labelType.height);
textSprite.graphics.endFill();
//...

Update: I’ve enhanced the drawString code with a mouse listener by putting another sprite on top of it by drawing an invisible rectangle behind the text in the same Sprite. You can see/download the complete example here.