Sunday, October 10, 2010

Ultimate Firefox Extensions!



Below is a screenshot of all the Firefox extensions that I have installed. These are all excellent for developers and designers!

WPF and Flash 9 Integration!


That’s right, it’s not a typo! This experiment started out as me simply trying to learn how to include Flash in a WPF project. There are many resources out there for doing this. Once I got that done I decided to take it further by incorporating some of the great new Actionscript 3 features in Flash Professional 9. If you saw my other experiments where I took audio spectrum data from After Effects and used it drive to WPF animations, you’ll remember me wondering if we could do this type of analysis on-the-fly. Well after a bunch of research I found out that it is possible but *very* complicated.
Then last week Adobe released a preview version of Flash Professional 9 which supports Actionscript 3It contains a new computeSpectrum() function that will do this very type of real-time audio analysis. I have done a few experiments using this and it is FAST! So this experiment is a WPF app that embeds a Flash 9 SWF. That SWF is playing and analyzing a music file. It is sending that information to the WPF app using the ExternalInterface API. The WPF app is then using that data to do some 3D animation on the 4 torus meshes which I built in ZAM3D. It also includes the Trackball class so you can zoom and rotate the objects as they animate.
Unbelievably it works like a charm! And not only that, but it is really fast and could probably handle much more data traffic between these two rival technologies :-)
Below is a rundown of the process I used and exactly what is happening here:
  1. The WPF app creates a regular windows form containing the Flash ActiveX control. It doesn’t actually get added to the visual tree however.
  2. It then loads the SWF file into the ActiveX control. I am hosting the SWF online because I couldn’t figure out how to include it with the build.
  3. The SWF file first loads the music file which is also hosted online. Due to sandbox restrictions you can only analyze files on the same domain.
  4. It then creates an EnterFrame event which analyzes the music file. The computeSpectrum() method returns 256 channels of audio data. Since I’m only using 4 graphics in WPF, I break the data into four bands and average them so that I end up with four bands of information.
  5. The SWF then calls a C# function and sends the data as XML using the ExternalInterface API.
  6. Lastly, I’m using this audio data to perform RotateTransform3D transforms on the four 3D shapes
This could open up so many possiblities as you can basically use Actionscript 3 in your WPF apps. Flash acts as the data provider to your application for things like animation and rich media. Of course I have no idea about performance or scalability. But it’s still a potential workflow for certain things.
You can get the application by clicking on the screenshot above and the source is up there too. The June CTP and Flash 9 are required to check it out.

Creating 3D Carousels Tutorial!

I just uploaded a new tutorial called Creating 3D Carousels that shows how to use the Math.sin() and Math.cos() function to build a slick looking 3D carousel. For some reason, people just love carousels. I’ll admit that I love them too. This is something that your client and boss will love, regardless of how useable it is :-) . See the finished product below and use your mouse to control the rotation.

Hope you like it!

Flash Professional 9 Released!!


Just when you thought it was safe to get some sleep, Adobe has released a preview version of Flash 9 with Actionscript 3 support. Go there right now and download it!