March 2006 Archives

JSON Tutorial

| 2 Comments | No TrackBacks

Mike Chambers posted a great tutorial demonstrating how to use JSON together with Flex 2 and ActionScript 3 to build an application.

The JSON library was something I created for the Open Source ActionScript 3 libraries released by Adobe. The libraries were recently updated to work with the Beta 2 release of Flex 2.

JSON is a lightweight format for describing data structures, and is handy for passing data between client and server (and has become more popular from usage inside the AJAX community).

Tags: , , ,

Google uses OSFlash

| 8 Comments | No TrackBacks

A few quick news items to point out:

Normally I wouldn't report about a new Google application, but this one is special. They're using Flash to create a highly interactive chart that blends well with AJAX. More importantly, Google used the Flash JavaScript Integration Kit to get Flash communicating with JavaScript.

Rock on OSFlash! I'm waiting for the day for Google to submit their own open source Flash project.... but, just knowing that Google is using open source Flash code makes me smile.

Oh, I turned 25 yesterday too. Go me!

The source code is now available for my ActionScript 3 Klondike Solitaire game showcased on Adobe labs.

I originally posted about the card game here and here.

I've finally had a chance to add the code into IFBIN's Flex By Example. To all existing subscribers, the example should be available for you to install as you read this.

If you don't want to spend the money to buy a complete license to Flex By Example, you can instead purchase the Klondike code separately, for US$50.

You can read an additional write-up here.

Thanks!

Tags: , , , , ,

Changing SWF Version With ANT

| 4 Comments | 1 TrackBack

There are plenty of tools out there to change the version information of a .swf file. However, I wanted to automate the process as part of my ANT build script, so I wrote a little Java class and ANT Macro to help me out.

You can download the .zip file here. Included in the .zip is the Java class and source code, as well as a sample ant build.xml showing how to use it. This is released under the MIT License.

Using the Java class inside of ANT is really simple:

<target name="updateVersion" >
	<convertSwfVersion filename="MyApp.swf" version="8" />
</target>
	
<macrodef name="convertSwfVersion">
	<attribute name="version" />
	<attribute name="filename" />
	<sequential>
		<java classname="com.darronschall.SWFVersionConverter" fork="true" failonerror="true">
			<!-- TODO: note the classpath here, you will probably need to change it -->
			<classpath>
				<pathelement location="flex/etc" />
			</classpath>
				
			<arg line="@{version} @{filename}" />
		</java>
	</sequential>	
</macrodef>

The Java class is just a few lines. It simply seeks to the correct location in the .swf file and changes the header information. There's no error checking or anything, so use at your own risk.

A friend of mine had asked if I had written anything like this before. I knew that I had, and found it in my old archives after digging a bit, so I thought I'd put an open source license on it and make it available to everyone. If you find it useful, great. If not, well, at least I can find it easily by searching google instead of dusting off old archive CDs. :-)

Tags: , ,

Introduction to Flex 2 Slides and Code

| 3 Comments | No TrackBacks

Last night I presented Flex 2 to the Central Pennsylvania ColdFusion User Group, right down the street from where I live. I've made the slides and sample code available for download.

The presentation was aimed at ColdFusion developers, so my goal was to show everyone how to get Flex talking with ColdFusion. I showed some of the basics of using MXML for layout, mixed in a tiny bit of ActionScript, and demonstrated how to connect to ColdFusion via HTTP (form post), WebServices, and Flash Remoting with the RemoteObject tag.

I wanted to get into ColdFusion Component and ActionScript 3 class mapping, but we were running low on time and it's not quite an "introduction" topic. However, there's a slide describing it, and you can see the sample code if you want to run through it yourself.

Thanks to everyone that came out - the turn out was actually better than I expected. I'm happy to have had the opportunity to share a little about Flex 2, and I hope my presentation was motivating enough for you to seek out more information to start building applications with it!

Tags: , , , ,

Introduction to Flex 2 Presentation

| No Comments | No TrackBacks

I'll be giving an "Introduction to Flex 2" presentation early next week, on March 7th. The presentation is for the Central Pennsylvania ColdFusion User Group, and will introduce Flex 2 from a ColdFusion developer's point-of-view.

The meeting will be held at the Country Meadows offices located at 830 Cherry Drive, Hershey, PA 17033, and will start at 6:30. If you plan on attending, be sure to RSVP at info@centralpenncfug.org in order for refreshments to be planned properly.

The presentation abstract is as follows:

Flex 2.0 extends the capabilities of the Flash Platform and allows for robust rich internet application development. Flex 2.0 is a major advancement to the Flash Platform involving a myriad of different technologies. For this meeting, Darron Schall will outline the different elements that make up Flex 2.0 and walk through creating an application with Adobe's latest offerings. Prior knowledge of Flex and/or ActionScript is not required.

My plan is to build a sample Flex 2 application that hooks up to a ColdFusion back end. The application will be on the simple side, but should give a general feel for Flex development. I'm hoping to raise a lot of questions and get people motivated to learn Flex 2. Overall, it should be a good time.

If you plan on attending, drop me a comment (and don't forget to RSVP as well). Hopefully I'll see you on the 7th!

Tags: , , , ,

How to use FlexUnit with FlexBuilder 2

| 15 Comments | No TrackBacks

A reader of mine asks, "Could you post an example of how you would utilize test driven design with ActionScript? I, like most developers, begin projects by coding first and planning later. I want to change this very bad habit but I am having trouble starting with test first."

When coding ActionScript 3, I do all of my testing with FlexUnit. Don't be confused by the "Flex" in the name - FlexUnit is fully capable of testing standalone ActionScript 3 code even though the name implies "Flex-only."

In order to get started, I'm going to walk you through the three step process of unit testing:

  • Create a "test runner" to run all tests and display the results.
  • Create the "test suite(s)" that contains the "test cases" to run. Each test is simply a method with a series of assertions to verify that the values the code is producing is what you expect the code to produce.
  • Create the class(es) that are tested by the test cases
Flex.org - The Directory for Flex

Archives