Bespoke App development for the Web and Devices



Slides from my recent talk about Javascript and the Haxe programming language

05.18.12 Posted in community, haXe, javascript, open source by admin

Last week I gave a talk to the local user group about targeting Javascript using a language that I am really enthusiastic about called Haxe.  I’ve been using it for almost two years now and am completely sold on it as a viable way to develop applications that can target both Javascript and Flash runtimes.  The language has an impressive array of features (strict typing, type inference, method inlining, block scope, oop etc) that is not available when directly coding in Javascript.  I found it very easy to get up and running with this language because of its ECMA style syntax.

Here is a link to my slides and to find out more about this language visit these links.

Post to Twitter


Review of haXe 2 Beginner’s Guide

08.07.11 Posted in community, haXe, open source by admin

You won’t find many book reviews on this blog (none actually – until now !) but I figured that this might be a good way to learn more about haXe.  The book in question is referred to as a beginner’s guide.  I don’t consider myself an absolute beginner but, with only a year’s experience with the language, I have much to learn.  Besides, my main focus has been Flash development and there is a lot more to haXe than creating SWF files.

This was part of the appeal to learning haXe in the first place – to not be tied to a single platform and to equip myself with the skills and knowledge to diversify if and when I need to or want to.

So how does haXe 2; Beginner’s Guide help with this?

Well, I’ve started learning how to develop on the PHP target after studying this book.  I’ve been planning on doing this anyway but now I’m a little ahead of myself.  I also tried using SPOD for the first time (and think it is a great feature!).  I was aware of SPOD before reading the book but the simple blog exercise in Chapters 8 and 9 made it very accessible to me – it turns out the basics are not that difficult after all.

Reading the book has also prompted me to look further into templating in haXe and I’m now considering using this feature to generate XML files for an upcoming project.

Would I have learnt about these features without reading this book?  Probably.  However, a book like this helps to accelerate learning by providing the relevant information to get started in a single place.  It is hard to find the time to learn new things and I am more than happy to get help with this.

On a side note, I noticed that the standard haxe.Template API is the templating system covered in the book even though other (more popular?) third party options exist (i.e., Templo and HTemplate).  I also noticed that JQuery, which has recently been added to haXe’s standard javascript API, was not covered in the chapter on javascript.  I would have liked to see some JQuery examples covered.

I found the book to be written in a very clear and accessible way and the information and advice contained in it is more than adequate to assist with getting started with haXe development.

The content of the book is also nicely structured – each chapter begins with a gentle intro to a topic that culminates with a ‘have-a-go-hero’ practical activity.

The book also follows a logical order with chapters building on what has been revealed in the preceding chapters – very conducive to learning being both continuous and progressive.  This seems like an obvious thing to get right but isn’t always the case.  I get a sense that a lot of thought has been put into it.  It could work well as a textbook to teach programming through haXe in schools.

The book is far from being a definitive guide to haXe though, nor does it claim to be by the fact that it is marketed as a beginner’s guide.  There is no mention of specific third party APIs although haxelib (a common repository for community libraries) is mentioned in the Preface.  There is also no coverage of the CPP target but this is probably beyond the scope of an introductory book and really merits a book of it’s own.

The Flash target, which is covered mostly in the final chapter, is not covered in any great depth – this suited me just fine since it is the non-flash areas that I was interested in.  It is fair to say that Flash is adequately covered as an introductory topic to the same extent as the coverage of Neko, PHP and Javascript though and Chapter 7 provides some really useful information about getting Neko/PHP, Flash and Javascript communicating with each other.

So would I recommend this book?

Absolutely.  This book is ideal for developers with no experience with haXe and also intermediate haXe developers with gaps in their knowledge and for those developers who are specialized in one area of haXe development but want to start broadening their knowledge.

Post to Twitter


haXe 2 Beginner’s Guide released

07.29.11 Posted in Best Practices, community, haXe, iPhone, javascript, open source, osx by admin

haXe 2 Beginner's Guide

The release of a new haXe book was announced this week by Benjamin Dasnois called haXe 2 Beginner’s Guide that I plan to review soon.  There aren’t many titles currently available for haXe so I was delighted to hear about this release and am looking forward to reading it and hopefully learning more about topics that have been on my todo list.  Stay tuned..

Post to Twitter


Using Flash CS5 as a layout editor for EaselJs

05.13.11 Posted in Box2d, community, haXe, javascript, open source by admin

The HTML5 Canvas element is a natural area for a Flash developer to explore so I decided a while back to play around with some of the options out there.

I’ve been using haXe for almost a year now and targeting Canvas using the Javascript target with my simple experiments has been fairly straightforward using Jeash (an API that mirrors most of the Flash API) because the workflow is identical to a Flash workflow.  Of course the Javascript target knows nothing about SWF files so it was clear that I was going to have to wean myself away from some of the really useful features of Flash like accessing linked library objects.  Adapting my workflow was what was required and luckily there are a lot of useful libraries that individuals and companies working with haXe have made available as Open Source projects.

Libraries such as Gm2d from Hugh Sanderson and the PushButton port called Hydrax have been interesting but I found the TouchMyPixel libraries to be particularly helpful.  Specifically, I like how they manage to use the Flash Authoring environment in their workflow even if they are not targeting the Flash Platform.

The TouchMyPixel code looked like a great way to further my knowledge of how to use haXe so I ended up forking their repository on my GitHub account and set about playing with the code and seeing if I could add support for EaselJs.

EaselJs is a library written by Grant Skinner and his team.  It effectively provides a displaylist for drawing on the Canvas element. The API design is clearly influenced by his Flash background since it provides a Flash-like displaylist but without it being identical to the Flash Displaylist. I was very happy when I discovered that Zjnue had already written the EaselJs externs for haXe.

What is nice about this approach is that I am using Flash CS5 to design layouts for Canvas-based applications and I could even make the same game or simulation also target the Flash Player. As an added bonus, the TouchmyPixel codebase has in-built support for Box2d and it didn’t take too much effort to get it working with EaselHx.

Click on this preview image to launch the Canvas demo. When open, click on the play button to start the simulation:

Click to see the Easeljs demo

Click here to see a version published as a SWF file.

A screenshot of the demo being created in Flash CS5:

assembling the layout in Flash CS5

Note: Bare in mind that my TouchmyPixel fork is just experimental – use the original TouchmyPixel codebase if you want to use something that is more tried and tested.  The CPP target is also not working in my forked project – maybe I’ll play around with that next.  Jeash is maybe a more feasible javascript option for haXe if cross-platform development and access to a more complete Flash API is important.

Post to Twitter