How to install the AIR 2 Beta SDK into FlashBuilder 4 and build a cool multi-touch app for your MacBook

Actionscript, Flex Add comments

Phew … that was a long blog post title! I have to be very specific about this little demo though because if you aren’t on a MacBook with a multi-touch trackpad this demo will not do anything and then you’ll be severely pissed! I’ve not done any tests with Windows so I’m not sure about touch screens or other AIR enabled devices. More information on this here.

Firstly, go and download the latest AIR 2 SDK Beta from here.

The first thing you need to do is duplicate your FB4 SDK folder which you will find in the Application/Adobe Flash Builder 4/sdks/ folder. Then copy the tbz2 download into that folder.

4.0.0 AIR 2 Beta
Uploaded with plasq‘s Skitch!

Now you need to uncompress the tbz2 (zip) to the duplicated SDK folder you created. You’ll need to do this in the Terminal app so open it and type ‘cd’ to change the directory and then drag the folder into the terminal to add the path. Then hit return to jump into that folder and enter this text to unzip the package …

tar jxvf AIR20_mac_sdk_*****.tbz2

… replace the asterisks with the version number of the beta you downloaded. You’ll have something like this in your terminal window :

Terminal 2014 bash 2014 80ղ4
Uploaded with plasq‘s Skitch!

Then hit return and you should see all the files being installed into the appropriate folders.

Now open Flash Builder 4 and go to the preferences to change the SDK. Choose the new SDK folder you duplicated which has now got the new AIR 2 packages installed.

Preferences
Uploaded with plasq‘s Skitch!

Now create a new Flex AIR project and go to the project preferences to choose your new compiler SDK:

Properties for MultiTouchTest_html
Uploaded with plasq‘s Skitch!

Now you are ready to build a new AIR 2 project with cool multi-touch events! And here’s one I made earlier which demos four of the new TransformGestureEvent Events that you can play with just using the MacBook multi-touch trackpad. It’s basically a small little app of a Monkey that you can scale with a pinch and rotate with a two finger twist. You can also drag him around with a two-finger pan and also make him spring up, down, left and right by swiping on the track pad with three fingers.

Let’s jump straight into the code. I’ve built this in Flex so I use MXML to generate my application window and add a simple Sprite object to the stage using SpriteVisualElement. There’s a simple SWC that contains a Sprite that I created in Flash and exported as ‘Monkey’. This can then be added to the SpriteVisualElement object as a child.

Here’s the full Application class :

View the full source and download the project here.

Grab the AIR file and play on your desktop here. You’ll need the AIR 2 runtime that you can grab here.

If you want to install your tests on an iPhone that’s a blog post for the near future … you can’t do it from within FB4 at the moment and I aint got CS5. My attempts at doing it from the command line failed but I think that’s because it doesn’t like the SWF that FB4 produced. Will look into it.

Hope you enjoy touching my monkey you dirty boys and girls!

Digg!

Leave a Reply

 
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in