PureMVC Tutorial – Flex, PureMVC, Jabber and XIFF 3: Part 1 – Frameworks

Introduction
Part 1 – Frameworks
Part 2 – Directory structure
Part 3 – Application and ApplicationFacade
Part 4 – Notifications, Commands & Use Cases
Part 5 – Model & Proxy
Part 6 – The Application View & Mediator
Part 7 – The Login View & Mediator
Part 8 – The Roster View & Mediator
Part 9 – The Chat View & Mediator
Conclusion, Demo & Downloads

Now that we’ve got a basic FlashDevelop project setup we can install the frameworks we’ll be using.

PureMVC

Download the PureMVC framework from here. Put this into a directory somewhere on your machine and add this to the FlashDevelop project classpath like so:

  1. Right click on ‘XIFFer’ and select Properties…
  2. Go to the Classpaths tab
  3. Click Add Classpath… and in the directory selector choose the PureMVC src folder.

XIFF

XIFF is an excellent Actionscript XMPP (Jabber) framework that we’ll be using to take care of the internals of Jabber communication. Its been around since Actionscript 2 but has recently been ported to Actionscript 3 (albeit in beta form). Download it here, put it into a directory and add the classpath as above.

As XIFF is currently in beta you’ll need to make a small change in order to get it to play nice with ejabberd – a common Jabber server written in Erlang. Research tells me that this is actually a problem with ejabberd’s implementation rather than XIFF’s, but whatever the issue might be this will fix it ๐Ÿ™‚

  1. Open org.jivesoftware.xiff.core.XMPPSocketConnection
  2. Goto line 108
  3. Remove the version=”1.0″ / so that the line now reads:

openingStreamTag = “<?xml version=”1.0″?><stream:stream to=”” + server + “” xmlns=”jabber:client” xmlns:stream=”http://etherx.jabber.org/streams”>”;

Now we’re all sorted with the bits we require and its time to set up our directories and packages.

8 comments

  1. I came to learn about using FlashDevelop with AS3.
    I got sidetracked into lots of things like PureMVC,
    Jabber, XIFF, etc. They look interesting, and of course
    I do MVC already in thousands of other forms.
    Not very useful at the moment.

  2. This tutorial is more aimed towards PureMVC than FlashDevelop. If you specifically want to learn about FlashDevelop then there are countless resources around the net where you can go – start at the official FlashDevelop forums and work out from there.

    Dave

  3. I must be missing something. I have gone thru the tutorial and even gone thru it using your source.. when the player launches all I get is a blank gray screen. Any help greatly appreciated

  4. Hey Jerry,

    Well spotted – PureMVC had changed the URL of the download page at some point since this tutorial was written. The link has been updated to the new location and you should be able to download as normal now.

    Dave

Leave a Reply

Your email address will not be published. Required fields are marked *