Cairngorm 2 (for Flex 2) – Simple Sample Applications

UPDATE: The Login example has been updated by Neil Webb to Cairngorm 2.2. Check out his series of articles explaining Cairngorm using the Login example.
I’d like to give you early access to a new version of the CairngormLogin sample, which we’ll ultimately make available on Adobe Labs. We’ve been releasing this very simple example application in earlier versions of Cairngorm alongside the framework code. Intention is to showcase how to get a simple Cairngorm application running. Furthermore, I’ve also upgraded my dashboard samples, which I’ve shown in previous posts.


I’ve done some little additions to the CairngormLogin sample that hopefully show a little more closeness to a real world Cairngorm application. There’s now a model object Login, which encapsulates login related states of the application. This object also contains a pending state, which a LoginPanel view listens to in order to prevent multiple login requests being fired before a running request has been returned. Also, there’s a delay in the delegate to simulate a remote service response. The code needed to call a remote service via RemoteObject is commented.
I’ve also updated the Dashboard examples to work with the latest Cairngorm release. Expect some further updates that actually add some real functionality to this in future.
see and download (right click and view source) the samples here:

As Steven Webster mentioned previously, expect more examples from us coming up soon and let us know when you’ve examples to show. I think the more the better!

29 Responses to Cairngorm 2 (for Flex 2) – Simple Sample Applications

  1. Ben says:

    Hi Alex,
    Thanks for the samples. I am hoping you can help me out though; it seems as if all of the Cairngorm samples I see are geared towards using RemoteObject. This is puzzling, because I wouldn’t think that the majority of Flex apps will have access to FDS. It is also disappointing, because I am trying to learn more about Cairngorm, but only have access to web services. I currently cannot get a WebService to work inside of Cairngorm. Can you help? More info here: http://groups.yahoo.com/group/flexcoders/message/42122
    Thanks,
    Ben

  2. Artur says:

    Thanks for the samples Alex! That’s exactly what I have looking for and it solves my problem.

  3. Ian Bale says:

    Something wrong with the samples, or just me?
    I just get this error from any of the links above:
    ReferenceError: Error #1069: Property hasDefinition not found on flash.system.ApplicationDomain and there is no default value.
    at mx.managers::SystemManager/getDefinitionByName()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::addingChild()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_addChildAt()
    at mx.managers::SystemChildrenList/addChild()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()
    at mx.managers::SystemManager/::initHandler()

  4. Malik says:

    Hi,
    Thanks for the Cairngorm Login Tutorial. I am trying to use it, but I seem to get an error in Flex Builder that points to:
    It appears the id=”login” and the class having the same name causes a conflict at least for me.
    Error:
    ‘login’: identifier and class may not have the same name. Login line 47
    I am using the code out of the box and I seem to get this. Any idea? I tried renaming it but it caused more error to appear which is what I figured would happen.
    Please help as this is a cool tutorial which helps the up and coming Flexers.
    -Malik

  5. AlexU says:

    Hi Malik,
    it seems that the model object com.adobe.cairngorm.samples.login.model.Login conflicts with another root MXML component, which is also called Login (Login.mxml). You can either use another name for the root MXML component as I did (i.e. CairngormLogin.mxml), or use absolute paths when using com.adobe.cairngorm.samples.login.model.Login in this project.
    Cheers,
    Alex

  6. AlexU says:

    Hi Ian,
    please make sure that you have the latest Flash Player 9 installed in the browser you’re testing with. (the one currently available in public)
    Cheers,
    Alex

  7. How do I download the CairngormLogin sample source code. The link refers to the actual Flex application.
    thanks Malcolm Edgar

  8. AlexU says:

    Malcolm,
    you can right click on the CairngormLogin sample application. Choose “View Source” from the context menu, similar to HTML.
    Best,
    Alex

  9. Hi Alex,
    thanks a lot for the demo app. It helped me a lot to understand how Cairngorm 2.0 works with Flex 2.0.
    Can you please add a little example how the server must be configured to access Remote Objects? As far I can see there changed a lot from Flex 1.5 to 2.0….
    Greets from the Niederrhein,
    Christoph

  10. Bela says:

    Hi,
    Thanks for the tutorial.
    I am trying to install it under Tomcat 5.5:
    First off, I deployed flex.war, found in the fds2 package, as cairngormlogin.war.
    After I copied the sample file in the right place as described in the Daniel Harfleet’ white paper Installation Guide for Cairngorm and Cairngorm Sample Applications (2005).
    Well , in the browser i ve got the source mxml…
    Should this install be as hard as a piece of “cairn” ?
    Can you tell me pls what else should i do ?
    Thanks Bela

  11. Amber says:

    Hi, Alex.
    When I click on the sample links, nothing fully loads, it just keeps “loading”. I tried to go to your website (www.alex-uhlmann.de/) and it will not load either. Is it just me? (I do have FlashPlayer 9 installed). I’ve tried it in Firefox and (yikes) IE.
    Thanks, Amber

  12. AlexU says:

    @Amber, the examples are currently hosted on my private domain and my domain was down yesterday. It’s up again, sorry for the inconvenience.
    @Christoph and Bela: Your issues are more Flex related than to Cairngorm. I’d suggest trying to work with Flex before you go into Cairngorm. IMHO, otherwise, you will have a harder learning curve. Check out Steven’s article about this topic.
    http://weblogs.macromedia.com/swebster/archives/2006/08/why_i_think_you.cfm
    That said, we plan on releasing more complex examples that would also give you more information about configuration but will not compete with the documentation provided by the Flex documentation. For now, please refer to the Flex documentation for configuration questions. You might want to check out Chapter 8 of Building and Deploying Flex 2 Applications and Part 6 of the Flex 2 Developer’s Guide. Check out flex.org > Documentation.

  13. Franck says:

    I’m trying ti get the sample running but
    I get the following error:
    “unable to load SWC cairngorm.swc: unknown element swc found in componentPackage section in catalog.xml”
    So I opened it &
    it bugs right at the begining:
    Why does it get stuck there?

  14. Franck says:

    Forget the previous post.
    wrong cairngorm.swc version (OOps!!)

  15. Chris Luebcke says:

    This seems to be a suitably long-lived thread, so let me throw in a couple things:
    1. Alex: Thanks!
    2. Don’t download the source code. Use the source browser for reference and recreate it yourself. You can do it in 2-4 hours and you’ll get a /lot/ more out of the exercise.
    3. The example should probably be updated to move away from the deprecated ServiceLocator.getService(), which only works for RemoteObject or WebService and fails at runtime for HTTPService, and instead use one of the specific getters (getRemoteObject(), getWebService() and getHTTPService()). I’m no expert and only noticed this myself when uncommenting and modifying Alex’s pattern to access a REST service through HTTP.

  16. Seth says:

    Thank you very much Alex, these were greatly helpful.
    Small criticism –
    Instead of saying ” latest Cairngorm release” please say “Cairngorm 2.1” if thats what you mean.
    I don’t know if 2.1 was latest when you wrote this or if 2.0 is what I should use. I suppose I can try both and see what works, but still, best practice for blogging is never to say “latest”.

  17. Michael Burbidge says:

    I can’t figure out how to get the source to the login sample. There is no view source menu item when I right-click. I’ve tried several different browsers

  18. praba says:

    Hi Alex
    Thanks for the samples whis you posted here.
    All are working well.
    and keep trying to post more samples.
    It may help many of them who are using cairngrom.
    once again thanks.

  19. praba says:

    hi michael
    I think in your browser the pop-up blocker may on.
    Just check that.
    I think that will be in your yahoo toolbar or some other place. just find out that then you will get a solution.

  20. rajasekhar says:

    please can u send me the documentation for flex using Cairgorm design pattern,
    how to install those things to build flex project,
    thanks
    rajasekhar

  21. rajasekhar says:

    I’m trying ti get the sample running but
    I get the following error:
    “unable to load SWC cairngorm.swc: unknown element swc found in componentPackage section in catalog.xml”
    So I opened it &
    it bugs right at the begining:
    Why does it get stuck there?
    Thanks
    Chintala Rajasekhara reddy,

  22. Mayur says:

    Rajasekhara,
    It seems that your cairngorm swc is of wrong version. Same kind of your problem has been posted here in comments.

  23. Bernard Poon says:

    Hi Alex,
    These are great samples, they really helped me visualize the concepts.
    I have a question, about the loginDate in Login.as vs. LoginVO.as. Is there a reason why you duplicated this property but used only the one in Login.as? Or was the one in LoginVO.as left on purpose to signify the loginDate set on the serverside vs. the one set when the client receives the result from the login?
    Thanks!

  24. dilip says:

    sir we want to compare validator in flex 2 and when compare the email address are we are not use compare validator.

  25. Prashant Shelke says:

    Got solution…
    In order to solve “unable to load particular .swc file:multiple points”
    this error, download source project for that .swc file, copy it in workspace,
    then import in mysclipse.
    As soon as project will get import, new swc will create.
    Now use that newly created .swc to get rid of problem.
    🙂

  26. Arivu says:

    Hi,
    i get error “Unable to resolve a class for ResourceBundle: CairngormMessages.”
    It looks like the Cairngorm and the source code is not matching, i have the latest cairngorm. what i should do now

  27. Arivu says:

    Got the solution…. :), its bcoz of wrong version of cairngorm

  28. arama motoru says:

    i get some errors

  29. kenneth says:

    when trying to use the cairngorm swc as a RSL I get the following error.
    VerifyError: Error #1014: Class mx.rpc.soap::WebService could not be found.
    But when I change the settings to merged into code it works fine. I’d preffer it if I could use it as a RSL, any pointers?
    In case it makes any difference I’m using flex builder 3 and I’ve downloaded the latest cairngorm files.