assertTrue is the professional blog of Luke Bayes and Ali Mills

HaXe Sample Application :: Simple Slide Show

Posted by Ali Mills Tue, 22 Aug 2006 05:15:00 GMT

If you’ve been reading this blog then it should be clear to you that I’m pretty interested in the haXe programming language (if it’s not clear see: Invest Regulary in Your Knowledge Portfolio, Where’s haXe?, HaXe Found!, and HaXe 1.05 Supports Flash Player 9!). My interest in haXe is rooted in my desire to build universally available applications with a code-base that I can grow.

To learn the haXe syntax and language APIs, I wrote a Simple Slide Show application that I call Mediator. Here it is:

You can download the source here.

Some interesting parts of Mediator follow:
  • the EventDispatcher class demonstrates many elements of the haXe syntax
  • background art is externalized in the FLA art/MediatorAssets.fla
  • slide data is externalized in the XML document xml/Mediator.xml
  • the MediatorModel class demonstrates XML parsing in haXe
  • the entire application has a flexible layout (which you won’t be able to notice unless you download Mediator.zip, run the Mediator.swf on your desktop, and resize it)
  • Events in the application bubble, this is handled by the Component class’s dispatchEvent() method; that method looks like:
    public function dispatchEvent(event:Event):Bool {
        var dispatched:Bool = dispatcher.dispatchEvent(event);
        if(event.bubbles && dispatched && getParent() != null) {
            getParent().dispatchEvent(event);
        }
        return dispatched;
    }

To compile the simple slide show, first download and install haXe, then download Mediator.zip, and after unpacking it double-click build.hxml.

To run the application locally without compiling, just double-click Mediator.swf.

Tags ,  | no comments

Comments

Your Reply

Comment Form.

Fields denoted with an "*" are required.