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
Here is a working demo of the application!
If you get a ‘Security Error’ when trying to connect, it means that the particular Jabber server you are connecting to hasn’t implemented its crossdomain.xml file correctly (many servers leave out the content-type which means that the latest versions of Flash Player will refuse to load it). Anyway, this security policy is ignored when running from your local machine so even if you have trouble using it here it will work fine when you compile it yourself.
You can download the full source code for the project here.
If you spot any mistakes, want to have a lively discussion or just want to say how much you enjoyed this tutorial please feel free to leave comments on the appropriate page!
My thanks go out to Jive Software for XIFF, Cliff Hall for PureMVC and all Flashers everywhere
Dave







Really nice tutorial!
I started developing with Flex and PureMVC couple of months ago and it was very frustrating that it is very hard to find good material about it. And I´ve never head of Xiff either! Your tutorial opened my eyes! Thanks a lot!
Grats!
I don’t see a link to a demo.
Dave
thanks for this. one thing that throws me is the use of wildcards for the class imports. it would be nice to see the list of specific dependencies
The PureMVC templates use wildcards specifically so that you don’t have have to worry about importing every class individually. For example, the ApplicationFacade template imports .controller.* so that you can instantly do RegisterCommand(NOTIFICATION, AnyCommant) without have to worry about it.
Even if you use a wildcard to import the AS3 compiler will only include classes that you’ve actually used in the SWF, so it won’t have any impact on the final filesize.
However, if you are set on using specific imports just delete the wildcards and (in FlashDevelop) go through the source selected each class and pressing Ctrl-Alt-Space to auto-import it.
Cheers,
Dave
Dave,
I am currently using flex and xiff to make a multi user chat and I was wondering if you knew of a way to get a list of the chatrooms that would be on the openfire conference server. I see how you create chatrooms but not how to view ones that are already created. Any help would be greatly appreciated. Great work on this tutorial!
Thanks,
Kyle Cleaver
Glad you enjoyed it
I’ve not actually done this before, but I’m guessing that its something to do with the Browser class. You need to query the chat service for a list of associated items - have a look at http://www.xmpp.org/extensions/xep-0045.html#disco-rooms for more info on the XML side of things.
Sorry I can’t be more help!
Dave
Hi Dave,
This is very nice tutorial. I enjoyed it but unfortunately I am not able to run from flex builder3.
Can you please let me know how to make it work in flex builder3. also I am not able to find user name and password to login from above screen to test it.
Thanks
eduser
The tutorial is really based around FlashDevelop, but the code itself should compile and run in FB3 just fine. The only thing you won’t be able to use are the FlashDevelop templates, but if you open them up in a text editor you should get the idea.
To get a Jabber username and password you just need to register with a jabber server (e.g. jabber.org) - however, there’s not much point as most public Jabber servers don’t implement the crossdomain.xml file needed to run a Flash client. Instead download and compile the source and run it from your own machine.
Sorry not to be more help, but fiddle around with FB3 and you’ll work it out
Dave
I am running this application in flex builder 3, but how to register a user to get username and password for this application.
Great tutorial.
Got it working with OpenFire (3.6.0a) server.
Had to do some modification thought.
1. need to use svn version of XIFF (Not the download version 3.0.0-beta1 ). org.jivesoftware.xiff.core.JID no longer exist. i’ve change all reference of it to use org.jivesoftware.xiff.core.EscapedJID
2. change all reference of function .toBareJID() to just .bareJID
Thanks for the comments! The trunk version of XIFF has a bunch of improvements - strangely enough I’m just finishing up a job using OpenFire 3.6.0a and ran into the same changes that you mention here
Another cool thing to try is to replace the connection instantiation in XMPPProxy.as with xmppConnection = new XMPPBOSHConnection();
Without any further work this makes XIFF use a BOSH connection instead of a socket connection - this seems to be a lot more reliable and stops the connection getting randomly dropped every 10 minutes or so.
Glad you enjoyed the tutorial!
Dave
Very nice tutorial. Helps to get into it.
Your job is very appreciated.