Update your PureMVC framework
Posted on August 15, 2008
Filed Under PureMVC | Leave a Comment
A new version of PureMVC AS3 is released - 2.0.4 . In this release the following bugs has been fixed:
- Dissallowed re-registration of Mediators in View.registerMediator.
- Modified View.notifyObservers to notify from a copy of the observer list rather than the actual observer list, which may change during the notification loop.
If this bugs are something new to you, read more on them here - bug 1, bug 2. And, of course, the download page to get a new release.
Jabber Client with Flex & PureMVC
Posted on July 21, 2008
Filed Under ActionScript, Flex, PureMVC, Tutorials | Leave a Comment
Just found a great and very detailed tutorial(with source) on creating a jabber client with Flex, PureMVC, Jabber and XIFF. It consists of nine parts:
- 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
As you can see, Dave Keen did a great job, and it’s really worth of taking a look.
Thanks Dave!
Creating Collapsible Pane
Posted on March 26, 2008
Filed Under ActionScript, Flash, Tutorials | 6 Comments
This is not a walkthrough tutorial, so you can download the source right now and explore it yourself. Below I explain the general concept of this component, which you might find usefull to understand the structure of.
Creating Collapsible Pane is rather simple.
First of all you have to understand from what parts it consists of. Generally it consists of identical windows and each of this windows consist of -
- Title bar ( which has Label TextField, Arrow, and might have something else )
- Content holder ( with background, it’s also a place to add assets to )
As for functionality this window has to resize itself to match size of added content, basic open/close states which are implemented by simply setting visibility of a content holder to true or false. And ,of course, such methods as setPaneLabel() or setPaneContent().
So, the actual CollapsiblePane class would just create thouse windows inside itself, handle their positioning, and have public methods to manipulate them. First you start by creating a new instance of a CollapsiblePane on a stage and then filling it’s data provider with an array of objects that in turn consists of a label and data ( {label:”Test1″, data: new Button} , for example). You can also directly add panes to it. [continue reading this post...]
Renju, The Game
Posted on March 10, 2008
Filed Under ActionScript, Flash, Games, PureMVC | 20 Comments
I have been playing this game for a while and thought that it whould be interesting to create my own flash version. For those who don’t know this game, a bit about it - Renju or Lianzhu is the professional variant of Gomoku, a board game originated from Japan in Heian Period. It was named Renju by Japanese journalist Ruikou Kuroiwa in December 6, 1899 in a Japanese newspaper Yorozu chouhou. Lianzhu is a Chinese translation of Renju. It is played with black and white stones on a 15×15 intersection board.
Two players, Black and White, alternately place two stones of their own colour, black and white respectively, on empty intersections of a board, except that Black (the first player) places one stone only for the first move. The one who gets five or more stones in a row (horizontally, vertically or diagonally) first wins the game.
So try it here. You can also download the source. Please note that this game is build on PureMVC version 1.7, and it won’t work under a new version 2.0.1 that has just been released. Just in case, I’ve included older version in source.
Hope you like it, and have fun.
Post Update: March 17, 2008
Implemented difficulty level functionality, some bug fixes and updated code to PureMVC version 2.0.1 . Download source.
For any thoughts about improving this game or bugs, leave comments.
Using WebServices in FMS
Posted on February 25, 2008
Filed Under ActionScript, FMS, Flex, Tutorials | 5 Comments
This one is a quick beginner tutorial on using WebServices in Flash Media Server. Here you will learn how to retrieve web-service data from server side and pass it to all users connected to application. As an example I’m going to retrieve weather forecast.
- Let’s start from creating a new application(folder) on server and
call it “webservice-tutorial” or whatever you like. - Create main.asc file and copy the following code.
// Load WebService component. load("webservices/WebServices.asc"); application.onAppStart = function() { trace ("Application Started"); // Load WebService. this.loadWS(); } application.onConnect = function(client) { // Handle client functionality... application.acceptConnection(client); } application.loadWS = function() { // Define WebService. weatherService = new WebService("http://www.webservicex.net/WeatherForecast.asmx?WSDL"); weatherService.onLoad = function() { trace ("weatherService loaded..."); // Invoke getWeatherByName method and set interval // to invoke it every 10 seconds for example. application.getWeatherByName("New York"); setInterval(application.getWeatherByName, 10000, "New York"); } weatherService.onFault = function(fault) { // Handle error here. trace (fault.faultstring); } } application.getWeatherByName = function(location) { // Invoke web-service method passing it the location. weatherByName = weatherService.GetWeatherByPlaceName(location); weatherByName.onResult = function(result) { var newObj = new Array(); // Loop throught result and push needed fields to array. for ( var i = 0; i < result.Details.length; i++ ) { newObj.push({day:result.Details[i].Day, min:result.Details[i].MinTemperatureC, max:result.Details[i].MaxTemperatureC}); } var c = application.clients; if ( c.length ) { // Loop throught clients and pass weather data. for ( var j = 0; j < c.length; j++ ) { c[j].call("setWeather", null, newObj); } } } weatherByName.onFault = function(fault) { // Handle error here. trace(fault.faultstring); } }
Everything should be clear if you have [continue reading this post...]