Tag Archives: tutorial

Video tutorial: Create native installers in AIR 2

One of the many exciting new features in AIR 2 is the ability to create native installers. That gives your AIR 2 application the ability to talk to native code. In this video I’ll show you how to build native installers for Adobe AIR 2 using the command line, and I also explore how my Package Assistant app simplifies that process. The Package Assistant that I’m using in the video is an older version and I think you’ll find that the current version is even easier to use.

Read full storyComments { 8 }

Video tutorial: Using the new states model in Flex 4

The states model has changed quite a bit in the Flex 4 framework but it’s a lot easier to use. In this video I show you just how easy it is to add different states and to add different behaviors and change properties based on the current state.

Also available on Adobe TV.

Read full storyComments { 2 }

The HTML5 Flash Marriage: Geolocation source

Last Friday I blogged about how HTML5 and Flash could also just work together. A few people have asked if they could get the source files. I just packaged and uploaded the FLA, ActionScript class and HTML files. Download the zip file here.

A few people have also noted that the demo doesn’t work across different platforms even when using the same browser. While I wanted to demonstrate how Flash and HTML5 can coexist and even complement each other, it is (sadly) also a demonstration on how HTML5 is being implemented differently across browsers and operating systems. Feel free to post a comment if you know about fixes or workarounds in the JavaScript to make it work on more browsers.

Read full storyComments { 4 }

The HTML5 Flash Marriage: Geolocation

I probably don’t need to tell you that there’s a lot of buzz (and fuzz) about how HTML5 is going to kill Flash. You probably know how I feel about this… I think the web is big enough for both of them… Even better… I think they could potentially complement each other!

Geolocation is a good example. HTML5 is going to get a geolocation API that works just beautifully even on devices with no GPS. Flash based applications will (currently) only get access to geolocation APIs when targeting the AIR runtime on mobile. Some browsers (I only know of Firefox 3.5 on Mac and the WebKit browser on the Nexus One) already support the HTML5 geolocation API… So why not use that to get geo information into your Flash based application?

It’s actually extremely easy to do…

But first a little bit of background as to why I was looking for this functionality. I’m actually building “this demo app” that needs the geolocation in order to have the functionality I was looking for. I want this app to work in as many places as possible. With the Flash Platform I can build this for my browser and my desktop. For the Apple phone I can export it as a native app and for the Nexus One I can use the device browser with Flash Player 10.1.

Now… How does it work? The HTML5 geolocation API is extremely easy to use and, like I said earlier, you don’t even need to have a GPS enabled device.

function getGEO()
{
	// First check if your browser supports the geolocation API
	if (navigator.geolocation)
	{
		alert("HTML 5 is getting your location");
		// Get the current position
		navigator.geolocation.getCurrentPosition(function(position)
		{
			lat = position.coords.latitude
			long = position.coords.longitude;
			// Pass the coordinates to Flash
			passGEOToSWF(lat, long);
		});
	} else {
		alert("Sorry... your browser does not support the HTML5 GeoLocation API");
	}
}
function passGEOToSWF(lat,long)
{
	alert("HTML 5 is sending your location to Flash");
	// Pass the coordinates to mySWF using ExternalInterface
	document.getElementById("mySWF").passGEOToSWF(lat,long);
}

In my Flash application, I’m using ExternalInterface so I can communicate between JavaScript and my SWF. When my Google Maps component is ready, I call the GetGEO JavaScript method:

ExternalInterface.call("getGEO");

When the JavaScript method gets a result from the geolocation API, it will pass it on to the passGEOToSWF method. In my Flash application, I just listen for that method call and then call the code to update the map.

ExternalInterface.addCallback("passGEOToSWF", onPassGEOToSWF);

If you don’t have an HTML5 ready browser, check out this video of the application running in Firefox 3.6. Even cooler is that this also works in the browser on my Flash Player 10.1 enabled Nexus One (Please note that the network is slower on the N1 and thus it isn’t able to keep up with loading new map images. This has nothing to do with Flash Player 10.1 or the application.):

If you have Firefox 3.5 or newer installed, you can give it a try yourself: http://www.webkitchen.be/geolocation. I’m sure there are other browsers out there that also already have the geolocation API but this is the only one I tested on the Mac.

Hopefully this gives you a good idea of how HTML5 and Flash can also just work together (instead of killing each other ;-)). Flash on!

UPDATE: While writing this blog post, @robertbak pinged me on Twitter saying that he wrote a library to use in your Flex applications. Check it out on the Flex Exchange.

UPDATE: For the source files check out this blogpost.

Read full storyComments { 39 }

Video tutorial: “Elf Yourself” yourself – Personalized video on the web


Note: Please update your After Effects CS4 installation to make sure you have the latest version available via the Adobe Updater. There is an issue with the preinstalled After Effects script that requires you to work with the latest point release (separate downloads available for Mac OS and Windows).

Ever wondered how you can create personalized video on the web? Want to create your own ElfYourself.com? This tutorial shows you how it’s done using After Effects CS4 and Flash Professional CS4. Ooh.. before I forget… One of my evangelist colleagues has a cameo appearance at the end of the tutorial ;-)

Read full storyComments { 31 }

Tutorial: Sexy transitions with Flex 3 (as used in the MAX widget)

When I showed the first versions of the MAX widget to a few colleagues, most were very surprised to hear that this was all built with the Flex 3 framework and that no Flash Catalyst or Flash CS4 was involved in this.

Including the animations?“, was a question I got a lot. And yes… Even the animations are “programmed” using the Flex framework. And you know what… It’s really not as hard as it sounds. The Flex framework actually has a bunch of effects built in and they are really easy to use.

In this case, I used 2 move effects and specified a “Back.easeOut” easingFunction. This easing function creates that bouncing effect that you see in the widget.

<mx:Move id="moveIn" yFrom="400" duration="350" easingFunction="Back.easeOut"/>
<mx:Move id="moveOut" yTo="400" duration="250" easingFunction="Back.easeIn"/>

You can use these types of effects in a number of different ways but the easiest way (I think) is to specify the showEffect and hideEffect on a component.

<mx:Canvas id="page1_back" showEffect="moveIn" hideEffect="moveOut" width="400" height="400"/>

When you set the visible property to false, the hideEffect will trigger and the showEffect gets triggered when you set the visible property to true. I’m sure you can already see how I built this ;-)

In the widget, you see 6 different pieces of graphics slide in to place over time. To do that, I created a timer that triggers my setup function over time.

var setupTimer:Timer = new Timer(150, 3);
setupTimer.addEventListener("timer", doSetupPage1);
setupTimer.start();

This timer will trigger the doSetupPage1 function 3 times with 150 milliseconds in between each call. All my doSetupPage1 function does, is set the visible property to true on the different pieces of graphics I want to show.

private function doSetupPage1(event:TimerEvent):void
{
    switch (event.target.currentCount)
    {
        case 1:
            page1_back.visible = true;
            break;
        case 2:
            page1_middle.visible = true;
            break
        case 3:
            page1_front.visible = true;
            break;
    }
}

To hide them, I’m actually doing exactly the same thing. Instead of setting the visible property to true, I set it to false and when all pieces of artwork are hidden, I trigger the function that reveals the next page.

[flash medium=5 w=400 h=400 mode=1]

To get you started, I created this little Flex project that demonstrates this approach. Now I’m not saying that this is best practice or not but I think it’s just an easy way to create sexy transitions with Flex 3.

download_manager_72x72

Download the source.

Read full storyComments { 5 }

Learn ActionScript 3.0 using Flash Professional CS4

In the summer it’s usually a little quieter at work so why not use this quiet time to learn something new? ActionScript 3.0 for instance. Doug Winnie, Adobe’s group manager for designer/developer workflows, just started a new series on Adobe TV titled: “ActionScript 1:1″.

doug.jpg

ActionScript 1:1 is a free training resource that combines video tutorials, documentation and sample files to teach you the basics of ActionScript 3.0 using Flash Professional CS4. The course is specifically designed for Flash designers and animators who want to add some custom interaction using ActionScript 3.0 but need a little bit of help getting started. Doug starts off with the very basics and then gradually explains more ActionScript that will make your designs and animations interactive and dynamic. He makes it very easy to understand and I’m sure you’ll be coding ActionScript 3.0 in no time.

ActionScript 1:1 is available on Adobe, through RSS and on iTunes. See Doug’s blog for the links to the videos and the sample projects.

Flash on!

Read full storyComments { 2 }

Video tutorial: Use Flex for your ActionScript coding for Flash CS4

There are a couple of ways you can use Flex and Flash together. I’ve already showed you a couple of those in previous tutorials. In this video, I’ll show you how to use the SWC files created by a Flex library project in Flash CS4. That way, you can have an ActionScript developer work in Flex who can then hand off compiled SWC files to a Flash designer.

Read full storyComments { 20 }

Video tutorial: Use the Flex webservice component in Flash CS4 projects

In this video, I’ll show you how you can use the webservice component from the Flex framework in your Flash CS4 projects. If you’re missing the webservice component in Flash, just use the one in the Flex framework.

UPDATE: My sincere apologies. There is an error in my code which I did not explain in the video.
Line 10 should not read myWebService.load but myWebService.loadWSDL.

I do remember we recorded this one twice and I fear that that’s where the mixup happened. Please download the working FLA below.

Download the FLA file.

Read full storyComments { 9 }

Video tutorial: Introduction to Adobe’s mobile platform

Adobe’s mobile platform has become a lot more interesting for Flash developers this week. Instead of having to open up the Flash Player on your device to watch the Flash content you created, you can now package your application using the Mobile Packager and distribute your application as an SIS-file for Symbian S60 or CAB-file for Window Mobile phones. Your users can now download and install your Flash based application on their mobile device just like any other application they install. What’s even cooler is that we also package a Flash Version Checker together with your application. As soon as the user launches the application, the Flash Version Checker is going to check if the Flash Player is installed and if it is the correct version. If not, it’s going to download and install the Flash Lite runtime seamlessly. Exactly like you would do on a PC and exactly as it should be. Check out Andrew Shorten’s blog post on the installation process.

I’ve recorded a little video that walks you through the process and will be doing more videos on how to build mobile applications soon.

Read full storyComments { 22 }
Page 1 of 212