AdobeStock_455007340

New Article: Building a Client-Server Application with Flash and ColdFusion

Last week I commented on the newly released Flash MX 2004 Wizards, and stated that I’d be posting a detailed article demonstrating their use shortly. Well, that article is now live at http://www.macromedia.com/devnet/mx/coldfusion/articles/dc_wizard.html. The article will walk you through building a complete application, from the back-end CFC code, to master-detail view data grids, to data entry, to popup windows and alert boxes … Enjoy.

13 responses to “New Article: Building a Client-Server Application with Flash and ColdFusion”

  1. Adam Avatar
    Adam

    I enjoyed the article, and picked up some good techniques, particularly use of forms. However, I suspect that new Flashers will read the article and pick up some less-than-ideal practices..I’m still wrestliing with a few of them. So, I wonder if you can comment on a few points:
    1. Why did you use WebServices instead of FlashRemoting, given that that you used a CF backend which natively supports FR. Is it because the FR solution would require hand coding? Is MM planning to make a similar "Flash Remoting Connector" to avoid the hand coding?
    2. At one stage, you decribe having to manually enter column headings because the Flash IDE can’t run the WSDL file to get the information. Seems like that should have been an essential feature to have in the IDE. I don’t recall non-CF backends having this problem….I’ll have to experiment further.
    3. You’ve hidden a lot of code behind buttons, but you’ve used a lot of absolute paths, starting from _root. I had the impression recommended coding practice was to put all code in an "Actions" layer, often in the first frame only. Your code might pose problems if you loaded the movie into another, for example.
    4. For the authentication, even though the user has logged in to gain access, shouldn’t you be resending the credentials with every WebService call to reauthenticate? Right now your WebServices are wide open for anyone to modify data. FR has setCredentials built-in, but I’m having trouble figuring out best-practices for WS implementations.
    5. With regard to #4, is there a way to make the login webservice encrypted (https?) but keep the others "regular" without triggering browser pop-up warning boxes and the like?
    Thanks, Adam.

  2. Ben Forta Avatar
    Ben Forta

    Adam,
    Great questions and comments. First, I must state that this is not intended to be a finished deployable application (as is noted in the article). There is far too much that I could not cover in the article that is extremely important. Having said that, …
    1) I used SOAP over Remoting because there is no Remoting control yet, and so the SOAP call is simpler. When the Remoting control will be available then that could be used the same way. From a CF perspective, however, the difference is for the most part irrelevant, which is a good thing.
    2) That is actually a CF limitation, not a Flash one. Think about it, CF is totally dynamic and totally runtime managed. If you have a CFC method which returns a query, CF itself does not know what columns will be returned until runtime, and so there is no way that that info can be included in the WSDL. Any client consuming CF generated WSDL has that limitation. And it goes beyond SOAP, even CFC introspection (in DW, or the HTML generated docs) have that same limitation. The only solution is for CF to become more strong typed, to require that the types be explicitly defined, but CF does not do that now, and whether it should or not in the future is a complicated debate.
    3) I agree, that is not ideal. I don’t think that it is inherently bad, it really depends on what you are building. For simple apps this type of embedded AS may be fine, for more complicated apps that would not be manageable. However, taking into account the target audience (knows CF but not much Flash) and article size constraints (it had already grown to 10 pages) that seemed like the best option. And for further reading, there are a whole set of links at the end of the article.
    4) You are correct, there is an inherent security flaw (as I noted on the final page) that service needs to be locked down. Passing credentials back and forth could work, although logging in once and maintaining state might be a better option too. But, that is definitely beyond the scope of the article (which is why I left it for the "Where to go from here" section).
    5) Sure, just use https in the URL instead of http. That will prevent eavesdropping, but it won’t solve the bigger security issue mentioned in #4 above.
    Thanks for your comments and feedback, much appreciated!

  3. Bill Avatar
    Bill

    An an excellent article and very timely for a current project. Flash is a key component because of it’s client-side presentation and platform independence. However I’m debating between CF and ASP.NET at the server.
    Is Flash able to read a dataset object presented by an ASP.NET web service?

  4. Ben Forta Avatar
    Ben Forta

    See page 2 of this article: http://www.macromedia.com/devnet/mx/flash/articles/flmxpro_webservices.html
    "One thing to pay attention to, however, is that Flash MX Professional 2004 doesn’t natively support ASP.NET DataSets as of this release. You can work around this by parsing web service responses yourself, but you cannot bind directly to the .NET DataSet."

  5. Joel Avatar
    Joel

    Is there a way to apply a time format on a particular column? I see that the Date format is there and that works great for dates. Thanks for the great article.

  6. David Mineer Avatar
    David Mineer

    This article is great. I appreciate helps like this.
    However, I have run in to a problem. The login form isn’t working. If I just click cancel it goes away. if I click login with the wrong password a blank alertbox pops up, and I can click ok to make it go away, but the login form won’t go away. If I put in "password" and click login,you see the form behind refresh but the login form won’t go away, not even if I click cancel. I am now using the completed code from Ben and same thing is happening. Is there some feature I should have and don’t? Everything else seems to be working fine.

  7. David Mineer Avatar
    David Mineer

    Well I dragged the alert component to the stage and then deleted it. This placed a reference to it in my library. This solves the blank popup problem. The "Login Failed" message now shows. But the login window will still not go away unless the first thing I do is click cancel.

  8. Chris Hanck Avatar
    Chris Hanck

    If you choose to use the DataGrid editor on the empDataGrid you may notice a problem when you get to the Login part of the tutorial; it doesn’t work! The problem is that the editor sets the editable property for each individual column. When you go to set the grid to editable at the login stage the property on each individual column overrides this. If you want to use the editor on this grid make sure to go into the script and remove the lines of code that set the editable property for each column.

  9. Susan Gallegos Avatar
    Susan Gallegos

    Ben,
    Thank you so much for the article. I only had one problem: I cannot get the DataGrid Column Editor to work. I have installed and uninstalled it several times but when I select the datagrid and click on the wizard button in the Component Inspector – it is grayed out.
    Thanks

  10. Martin Thorpe Avatar
    Martin Thorpe

    Hello, I agree with Adam about the web services. It suprises me that a remoting connector was not included with the original release.
    There are a number of open source extensions to enable remoting for php/java.
    There is a remoting connector component, to complement the XML/webservices connectors, available here:
    http://www.amfphp.org/components/
    There have been benchmark tests comparing the use of SOAP and remoting. Remoting comes out as a better performer, can be read here:
    http://www.flashorb.com/articles/soap_vs_flash_remoting_benchmark.shtml
    It just worries me the lack of initial evidence of remoting use within Flash MX 2004. Webservices are a bit of a fashion at the moment and I am hoping this is the only reason that MM are highlighting these areas and not considering fading out remoting.

  11. Jonathan Keller Avatar
    Jonathan Keller

    As the others, I liked the article and got a number of good ideas on how I should architect data-driven applications using data binding.
    I am currently working with JSFL to read some information from the FLA file. What I can’t find using the JSAPI is where the component binding is stored. After banging away at it for a while, I realized that this wizard must have used the API since it set up the bindings. I went to the install directory and found, alas, that the files were encrypted.
    I’m not asking for the source code, but could you post a link to some information on how to manipulate component bindings from JSFL?
    I’m sorry if this is not the best place to post this, but I wasn’t sure where else to try. Thanks.

  12. jafang Avatar
    jafang

    I LOVE YOU MANNNNN!
    I was planning to blow my computer to get even with Flash Data Connection, but out of no where you show up with this article.
    Thanks for the article. you the best..
    Jafang
    Canada

  13. Chris Best Avatar
    Chris Best

    First I greatly appreciate your unselfish availability of your knowledge and wisdom.
    I’ve learned a lot from your numerous articles and postings.
    I must have missed the reply; Im also wishing to
    display the TIME format in the datagrid from a cfc that returns odbctimedate formatted field.
    Thank you in advance
    clb

Leave a Reply