19 October 2006

Tutorial: Building Version Numbers into SWFs using ANT and SVN

Written by Richard Leggett ( Contact the author of this post )
Published on October 19th, 2006 @ 03:05:01 am, using 711 words, 1868 views
Categories: Flash

A colleague suggested it would be useful to build in version numbers into SWFs so that you could simply right click and see just what version you were looking at. Think in terms of QA or a client on the phone. With continuous integration it is useful to be able to say "hey just right click... so it says r12345?". The r12345 here would refer to the revision number in Subversion. This makes bug tracking say using Trac much more integrated.

Sample (zip at end):


The premise is simple. When you run your ANT build script from Eclipse to compile your SWF, it injects the current revision number into an AS file, which the swf then includes and uses to build a new context menu item containing said revision number. Here's how to do it...

Installation and Pre-requisites:

You will need:

*Be sure you have the LATEST (1.4+) version of Subversion installed, not Tortoise, the Subversion client itself. Download from: http://subversion.tigris.org/project_packages.html

Step 1:

Assuming you already have Eclipse set up. Install svnANT by downloading the zip from the above URL and extracting the following two files:

  svnant.jar
  svnClientAdapter.jar

...into your ANT lib folder, e.g.:

  c:\eclipse\plugins\org.apache.ant_1.6.5\lib

Step 2:

Now before you can use your newly installed svn tasks in build files, you have to make sure these two JAR files are included in your external tool classpath. You can do this by clicking the downward arrow to the right of the External Tools icon that you normally press to run a build ( looks like the little red toolbox with the green icon run external tool ).

In the Classpath tab, add the two as external JARs. (see screenshot addSvnAnt.jpg).

adding svnAnt
(click to enlarge)

The alternative method is to just add the two JARs to your build file's classpath, but this way saves that hassle. But if you do not wish to add these JARs to your ANT you must manually include them on a per instance basis in your ant task with the following line: <taskdef resource="svntask.properties" classpathref="project.classpath"/> where project.classpath is the folder they live in.

Now Restart Eclipse (use -clean flag if you experience problems).

The Build File:

You can now make use of the new tags available to you to perform any Subversion related tasks you wish. The docs are avaible as part of the svnANT download zip. In this case we will get the latest revision number for our src folder and then add that to a file which we can #include which we will include to add our context menu to our base SWF.

Step 3:



In the build file, add another target that looks like this:


<property name="src.revision" value="null" />
<tstamp><format property="today" pattern="d-MMMM-yyyy, hh:mm aa" locale="en"/></tstamp>
<target name="Include_SVN_Revision" >
<svn javahl="false" >
<status path="${main.file}" revisionProperty="src.revision" />
</svn>
<echo>Building revision::::: ${src.revision}</echo>
<copy file="${basedir}/revision_template.as" tofile="${source.dir}/revision.as" overwrite="true" >
<filterset>
<filter token="revision" value="${src.revision}" />
<filter token="timestamp" value="${src.revision}" />
<filter token="user" value="${user.name}" />
</filterset>
</copy>
</target>

( ${main.file} is just an ANT property pointing to your base/application FLA. )


You might just want to look at the build file in the download at the end. Basically all this is doing is injecting some meta data into an ActionScript file which we can later include...



Step 4:



In your FLA (or AS class), you just need to #include the revisions.as file, and add the following code to add the context menu:


var cm:ContextMenu = new ContextMenu();
var revisionCM:ContextMenuItem =
    new ContextMenuItem( "r"+_level0.svnRevision, function(){} );
cm.customItems.push( revisionCM );
this.menu = cm;

That's it. Sample should be clearer than the above garb. Here's a sample download and below is a sample swf:


17 October 2006

Ms. Dewey - A Hotter (Flash) Search Engine

Written by Richard Leggett ( Contact the author of this post )
Published on October 17th, 2006 @ 02:52:44 pm, using 59 words, 351 views
Categories: Flash, RIA, Serverside

Ms. Dewey makes searching the web a little bit more fun. I tried a search for "Flash" to what she says: "Nothing gets a girl hotter than talking about code. Lights, camera, ActionScript.". The load times seem quite high because of the amount of video used but it might also be a server issue at the moment.

Search now.

LFPUG: Visual Interfaces for the Human Brain and Flex 2 for Flashers

Written by Richard Leggett ( Contact the author of this post )
Published on October 17th, 2006 @ 01:53:11 pm, using 98 words, 152 views

Next Wednesday (25th Oct '06) my colleague Rob Bateman and buddy Tink will be hosting another LFPUG (London Flash Platform Usergroup). They will be speaking on Visual Interfaces for the Human Brain and Flex 2 for Flash Developers respectively. Tasty stuff. Last time was a lot of fun even though I had to rush off after my preso, but the venue was really nice so hopefully see you there. Remember to sign up to make sure you get in:

Sign up here.

Hopefully this time Stefan (FlashComGuru) will also be able to hook us up with some more live streaming!

MVC and History Management... in the Pub

Written by Richard Leggett ( Contact the author of this post )
Published on October 17th, 2006 @ 03:34:48 am, using 208 words, 148 views
Categories: Flash, RIA

Just got sent this image of last night from a co-worker, Dan Wood. I'm trying to convince Dave Wiltshire on the left of the picture here of my HistoryManager and DeepLink classes in terms of their ability to de-couple views and stop you having to worry about the logic of user journies in your apps/sites.

(Click to enlarge)

It works very simply by giving you a way to initiate navigation requests by user action or direct from the app itself through a central HistoryManager which only your AppController listens to. This means you can do things like automatically generate tracking calls, tie it into the browsers history management etc. On the return journey (acting upon that deep link request) it sets in place a traversal of handleDeepLink() calls down your views so that they can handle the various "levels" in the deep link as they see fit, attaching/removing or loading ContentSections. As an added bonus we can also create RESTful URLs by including parameter notation in any level of the deep link we desire, e.g. "maps|uk|england[x=20,y=50]". This is part of something we are working on, but more of that later.

Dave just now: "Can't we have all documentation like this?" - brilliant :)

12 October 2006

HD Fullscreen Flash Video - Demanding More

Written by Richard Leggett ( Contact the author of this post )
Published on October 12th, 2006 @ 03:23:21 pm, using 323 words, 1653 views
Categories: Flash

So I saw the full-screen video examples the other week using the new Flash 9 update, but the example at the end of this post really pricked my attention.

I went out and got a HD TV a couple of months ago because I figured it was time to make "the leap". As yet I don't think I've made any sort of decent use out of that particular feature apart from watching some Lost s3 over the wifi via a ye olde xbox-1 with media center (convergence is beautiful). Now I'm a firm believer that this whole Blu-Ray, HD-DVD thing is a flash in the pan; a very temporary stop-gap. The last time I bought a physical CD was probably 5 years ago. The last time I bought a DVD, probably a couple of weeks. Why? Because until now only Apple and two companies in the U.S. only have offered full movie downloads in any sort of reasonable, legal manner.

Now we -and it's up to you to define "we"- have pretty much unlimited hard disk space, especially when it is hosted by someone like Google, and of course a fairly fast connection to the internet. So why on Earth are we still buying films on physical media. Apple's solution is ok, but I'm not sure I can access it in the UK yet, regardless the quality is pretty poor at 640x480. So where do we go from here...

I for one would be extremely happy to pay a good price for the latest movies, maybe a flat rate yearly subscription, if they came in the sort of quality that Flash 9 is now offering. Check out this example from Fabio Sonnati for one. No noticeable buffering, glorious high-def fullscreen video. If the rate is low enough, forget hoarding a collection of space hogging DVDs, let's have an enormous collection of online up to date movies to dip into.

Here is that example again (1024 x 576).

About

Richard Leggett is a Senior Creative Developer at AKQA, London. He is co-author of Foundation Flash Applications for Mobile Devices (Friend of ED), an Adobe Community Expert and speaker at industry conferences and user groups.


October 2006
Mon Tue Wed Thu Fri Sat Sun
 << < Current> >>
            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          

Categories

Miscellany

XML Feeds

Information

Contact the admin  /   b2evo template by Two18 Media