nwebb

Flex, Flash, AIR

Cairngorm Login (HTTPService example with PHP)

I wanted to address some of the Cairngorm-related issues people are writing to me about – they mainly involve the Service class and how to retrieve data from a WebService or HTTPService.

Here is a quick working example of the Cairngorm Login sample application which uses HTTPService with a very simple PHP script.
Right-click for the source code. I’ve commented it and included the php (don’t overlook the readme.txt in the same folder which tells you where to put the php).
When looking at the Flex code pay special attention to the LoginDelegate.mxml and Service.as classes.

Edit: I don’t seem to be able to get this working nicely with the “KLM FlashEmbed” WordPress plugin I’m using – even if I use a hard-coded url to the php (yes, I’ve changed it from localhost ;) ).

You can still right-click the application above to get the source.
If you want to see a working example of the application, go here (but you can’t right-click it for source).

If anyone has resolved this issue before please let me know – cheers

7 comments

7 Comments so far

  1. James Gardiner October 4th, 2007 8:11 am

    Hi,
    loving your blog. Great stuff.
    However, I was wonderig if you could expand on this a little. This is exactly what I am after, however, I am trying to use amfphp1.9

    I am not sure where defining my, for example..

    />

    And how it all works in with your examples.
    Could you please point me in the right direction?

    THanks,
    James

  2. James Gardiner October 4th, 2007 8:14 am

    The code appears to have been ripped out..
    I was mentioning where I have
    mx:RemoteObject id=”loginRO” destination=”empService” source=”Myservice” fault=”faultHandler(event)” showBusyCursor=”true”
    mx:method name=”LoginService” result=”resultHandler(event)”/

    /mx:RemoteObject

    Taken out character I feel did not work in the initial post.

    Thanks,
    James

  3. tsclausing November 14th, 2007 5:52 pm

    This is a great simple example. The comments in your code were especially helpful. Thanks.

  4. Alonzo Hosford March 9th, 2008 9:38 pm

    Viewing source and clicking on php results in 500 error

    http://nwebb.co.uk/nwebb_example_code/cairngorm_login_php_example/srcview/source/php/login.php.txt

    Is it available for viewing?

  5. nwebb March 10th, 2008 9:18 am

    Hi Alonzo, yes you just need to download the zip file (see bottom of the left-hand pane in srcview – http://nwebb.co.uk/nwebb_example_code/cairngorm_login_php_example/srcview/)

  6. Alonzo Hosford March 10th, 2008 11:47 am

    Ah too obvious. Thanks muchly.

  7. ravi June 17th, 2009 9:24 am

    thanks for the post neil…it helped me in my application..
    i know it’s a old post but regarding the PHP file not accessing using KIMILI flashembed pligin, i didn’t have any problem…i’ve created a sample post here if you want to check:
    http://ravimarella.com/getriaed/?p=3
    thanks for the post again..
    cheers,
    ravi

Leave a reply

Bad Behavior has blocked 517 access attempts in the last 7 days.