Issue 138 of the WebDesigner magazine hit the shops today and I wrote a mammoth size tutorial for the edition based on sending data to and from a MySQL database using Flex and ColdFusion. I really wanted to also show how to fit the whole application into a PureMVC framework due to my becoming a huge fan of Cliff’s work, so the whole tutorial builds the application using PureMVC so you can gain an insight into the framework.

I have noticed for a long time now more and more people wanna know about how to use Flex and ColdFusion together in a basic manner utilising a database (hence my choice of topic), use PureMVC and your opening the doors for reusability and additions in the future.

Its always a daunting thought when you have become comfortable with building certain applications to start changing your approach to and structuring of an application, but for me its been well worth it. So take a look and have a go, its a nice small application to get started with and also one that can be adapted easily and used in a real world situation….. ave a go!

webdesignermag

Tutorial Image

Wahay, I am now an official contributer to the Web Designer publication over here in the UK. I have just had my first article published in this months issue (137) and wrote a tutorial on how to build a simple one to one video chat application using Flash Media Server and Flash CS3/ActionScript 3. I am really chuffed to cover FMS as it is an area we do not see to often in publications over in the UK so thanks to Web Designer for supporting me on this one :)

Watch out for next month…. Flex, ColdFusion and PureMVC :)

Gonna keep this short and sweet cos its covered elsewhere but was a pain for me so gonna blog it!

Task: Upgrade Flash Player from 9,0,45 to 9,0,47 in FireFox

Problem: When it comes to running a project from Flex Builder 2 an error message pops up stating:

*C:\Program Files\Mozilla Firefox\plugins\NPSWF32.dll

Flex Builder cannot locate the required version of the Flash Player. You may need to install Flash Player 9.0 or reinstall Flex Builder. Do you want to try to run your application with the current version?*

Solution: On installation of the Flash Player the NPSWF32.dll file is copied to C:\WINDOWS\system32\Macromed\Flash. Copy NPSWF32.dll to C:\Program Files\Mozilla Firefox\plugins\

You may recall my previous tutorial on flash remoting using ColdFusion to retrieve data from a MySQL database. I recently took it to the next step and have written a tutorial for fusionauthority showing how to add/update/delete data from a MySQL database using Flex and ColdFusion! More to come on that one on release…

Following completing the tutorial I decided I wanted to recreate the application using the PureMVC framework I have been raving on about recently. So here we go, all the source files for the said FlexCF PureMVC application. Its a simple app to demonstrate the framework logic and obviously I am new to PureMVC so overtime there may some refinements to made which I will aim to update you on.

You may note now I have created a RemoteDelegate class which handle all the remote calling functionality to ColdFusion and means that I can easily reuse the class in other projects which is the name of the game for MVC you tell me!!! The RemoteDelegate constructor expects 2 parameters, a responder (the calling class in this instance) and a url to the cfc. There are 2 methods, one to get all the data from the only table in the MySQL database and a callCFC() which is parsed the relevant method to call on the cfc i.e. update, add or delete.

See what you reckon and I would love to hear of any suggestions to improve!

source

Here is a mega simple Flex contact form which utilises a ColdFusion script to send variables to chosen email address. Trust me this is as simple as it gets so don’t expect anything fancy, I just needed something quick and easy and this is it, plug it in and allow users on your site to send comments etc…

Contact Form Flex & ColdFusion components

So I feel confident writing OOP using AS2, AS3 obviously enforces it to a higher degree than ever before and I have been happy as a pig in muck to wallow around building classes left right and center for my applications. Then I read an article from Ted On Flex describing how some hardcore programmers from companies have created jaw dropping flex applications in stupidly swift time scales with NO flex experience at all. This is all down to the ability to construct applications using solid frameworks for creating components which is translated across most programming languages.

Pretty much every day now I am working with Flex and knew it was time to wake up and smell the gravy and take it to the next level. So after a swift kick up the jacksy from me man Stefan we hooked up and checked out an interesting framework for our AS3 and Flex applications! PureMVC is the chosen framework of choice after some deliberation and I am aware that we are going against the grain to certain extent as Cairngorm seems the popular choice, but the frameworks are very similar and I did note that there are some advantages to PureMVC over Cairngorm (in my opinion) and also it seemed a little less of a head spin to kick off with.

The guy behind it all is Cliff Hall who I had the pleasure of having in depth discussions with regarding PureMVC and the documentation and source files on his site provide more than adequate information to getting started. It is still early doors but this is the most positive move I feel I have made in my career as a developer and a move I should have made a long time ago. I have a much clearer insight now when designing the application from the start and am confident that as they grow they are going to be structurally sound and I will no longer dread that app that you have to go back to and add functionality cos it will be as simple as plug and play!

It would be interesting to hear what frameworks developers are using out there and how it has affected them, anyone else used PureMVC? How do you personally architect an RIA?

Check out the Architecture 101 Beta Courseware and give it a go!

My mum recently got hooked up with her own lap top and due to the distance between us got a web cam to chat with my kids, nice move! Problem was her first trial with Instant Messenger started of with a few hurdles in the registration process and ultimately ended up with the blue screen of death on first flicker of live video???

So I thought I would develop a 1 to 1 video chat application using Flash Media Server and Flash to get the kids talkin’ to grandma :) I wanted a super simple, no entering text or jump any hurdles solution with client id to be handled server side. The server side script for handling clients is below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if( application.clients.length == 0 )
  {
      trace( "Me: "+ client.id );
      application.acceptConnection( client );
  } else if( application.clients.length == 1 )
  {
      trace( "Me Mum: "+ client.id );
      application.acceptConnection( client );
      application.clients[0].call( "ready", null, application.clients[0].id, application.clients[1].id );
      application.clients[1].call( "ready", null, application.clients[1].id, application.clients[0].id );
  } else
  {
      trace( "REJECT: "+ client.id );
      var err = new Object();
      err.message = "This is a AB chat so C your way out!";
      application.rejectConnection( client.id, err );
  }

Called mum gave the URL and hey presto, kids and grandma chatting away happily and no blue screen of death!!!

Gonna blog about me being a bit of a plonker and trippin over a small stupid error I made which got me confused for a hot minute. I am gonna make it short and sweet! When you take your flex app that uses ColdFusion and the RemoteObject and deploy it on your remote server your RemoteObject source will look something like the following:

source=”flexCF.assets.cfc.UserManager”

And I got Unable to invoke cfc which is unusual as I tend not to have any beef like that thrown at me! Yeh, check me out, I wanted to store this application in a directory named for example ‘myfolder’, so in it went and that is where the trouble began. Stupid but you never know if anyone else may do it too. The RemoteObject source tag is looking for the flexCF directory in the root folder

i.e. webroot>flexCF>assets>cfc>UserManager

And here was my cfc chillin on the starboard:

webroot>myfolder>flexCF>assets>cfc>UserManager………DOH!

Whoa, what a journey its been, Flex & ColdFusion a partnership made in heaven???? hmmmmmm, all I can say is its wicked once its working. So, I am writing this post so it must be working, so far mac and pc both like it which is cool, further debugging is needed but thought I would get it up and blogged.

CURRENTLY UNDER RECONSTRUCTION!!!!

A client wanted a site for providing potentially shed loads of data, videos and downloads, so I thought Flex could be fun for this one. Only problem was that I also needed a content management system for the client to update and add to the site as there may be a quick turn around of information. Read on →

Ok, this is a problem I solved a wee while ago via google and it is something that I have recently encountered on my shared remote server with support not aware of the fix…so I thought best broadcast.

Problem: Error Executing Database Query. Value ‘0000-00-00’ can not be represented as java.swl.Date

The datasource is set up with a JDBC URL of: jdbc:mysql://localhost:3306/newtriksexample

Solution: Append this to the end of the url: ?zeroDateTimeBehavior=convertToNull So we will have: jdbc:mysql://localhost:3306/newtriksexample?zeroDateTimeBehavior=convertToNull