Switch On The Code RSS Button - Click to Subscribe
Jul
8

Flex & PHP Tutorial - Transmitting data using JSON

To make sure we don't get too stuck in a rut with our tutorial posts I decided to branch out a little bit and talk about Adobe Flex 2.0. I recently spent a lot of time figuring out how to do this. Basically what I am going to go over here is how to use php and json to send data to your flex application, and then how to use that data in Flex.

This is actually a lot easier than it seems because PHP and Flex both have functions to handle json data transmissions. For Flex, the one thing you need to make sure is that you have the corelib from Adobe in order to use the JSON functions - this can be found at Adobe Flex coreLib. This can be added to a project in Flex builder by going into the properties of a project then to "Flex Build Path" and adding the .swc to the library path. For PHP, if you have a version greater than 5.2, you are all set. If not, you can either upgrade, or install the php-json extension.


Below is the final product of what we are going to create today - to view the Flex source right click the flash movie and select 'View Source'. Pressing each of the buttons sends a request to our php code for data. If you click the "Get Employee" button we just get a single person back, and if you click "Get Manager" we get a manager back and his employees (which is an array of people). This is a very simple little app, and not particularly useful, but it does have everything needed to show how to communicate between php and flex using json.


The first thing we are going to go over is the php code. The php code creates a few classes for the objects that we will pass to our flex application. We also have code to check if a GET variable has been set, we use this to tell the php code what we are requesting. If the variable "getPerson" is set we create a person and echo it (after we encode it into json) to send it to the Flex app. Ideally your data would be stored in a database, but for simplicity, we're just creating Person objects directly in the php code.

<?php

class Person
{
    public $first_name;
    public $last_name;
    public $email;
    public $address;
}

class Manager extends Person
{
    public $title;
    public $employees;
}

if(isset($_GET['getPerson']))
{
    $p = new Person();
    $p->first_name = 'Chuck';
    $p->last_name = 'Killer';
    $p->email = 'fake@email.com';
    $p->address = '5555 Some Street City, State 52423';
    echo json_encode($p);
}


if(isset($_GET['getManager']))
{
    $p1 = new Person();
    $p1->first_name = 'Joe';
    $p1->last_name = 'Schmoe';
    $p1->email = 'joe.schmoe@email.com';
    $p1->address = '5424 Some Street City, State 12314';
    $p2 = new Person();
    $p2->first_name = 'Bob';
    $p2->last_name = 'Hacker';
    $p2->email = 'bob.hacker@email.com';
    $p2->address = '1414 Some Street City, State 12412';
    $p3 = new Person();
    $p3->first_name = 'Kevin';
    $p3->last_name = 'Putvin';
    $p3->email = 'kevin.putvin@email.com';
    $p3->address = '6123 Some Street City, State 41241';   
    $m = new Manager();
    $m->first_name = 'Manager';
    $m->last_name = 'Dude';
    $m->email = 'manager.dude@email.com';
    $m->address = '5534 Some Other Street City, State 91230';
    $m->title = 'Office Manager';
    $m->employees = array($p1, $p2, $p3);
    echo json_encode($m);
   
}
?>

The next thing to do is setup the basic application for flex. The following code is the simplest flex application. This sets up an application with specified height and width and also adds the view source option to the movie, with the source file specified by "viewSourceURL".

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute" width="500" height="410"
    viewSourceURL="../files/JSONTutorial.mxml">

</mx:Application>

The next thing to do is setup the user interface. This is pretty standard flex mxml, nothing should look out of place. The user interface has a couple of text fields for the data we get back from the php code, a datagrid, and two buttons. This is all setup on a panel. The one important thing to observe is that the dataField properties on the DataGridColumns, these names correspond to the variables from the objects in the php code.This code goes inside the Application block.

<mx:Panel x="0" y="0" width="500" height="410" layout="absolute"
     title="Simple JSON Example">

    <mx:DataGrid x="10" y="174" width="460" enabled="true"
             editable="false" id="dgEmployees">

        <mx:columns>
            <mx:DataGridColumn headerText="First Name"
                            dataField="first_name"/>

            <mx:DataGridColumn headerText="Last Name"
                            dataField="last_name"/>

            <mx:DataGridColumn headerText="Email"
                            dataField="email"/>

            <mx:DataGridColumn headerText="Address"
                            dataField="address"/>

        </mx:columns>
    </mx:DataGrid>
    <mx:Button x="116" y="338" label="Get Employee"
            id="getPerson" />

    <mx:Button x="266" y="338" label="Get Manager"
            id="getManager" />

    <mx:Label x="131" y="12" text="Name"/>
    <mx:TextInput x="189" y="10" id="txtName" editable="false"/>
    <mx:Label x="131" y="42" text="E-mail"/>
    <mx:TextInput x="189" y="40" id="txtEmail" editable="false"/>
    <mx:Label x="131" y="68" text="Address"/>
    <mx:TextInput x="189" y="66" id="txtAddress"
            editable="false"/>

    <mx:Label x="131" y="94" text="Title"/>
    <mx:TextInput x="189" y="92" id="txtTitle" editable="false"/>
    <mx:Label x="131" y="122" text="Has Employees"/>
    <mx:TextInput x="229" y="120" width="120" editable="false"
             id="txtEmployees" text="No"/>

    <mx:Label x="10" y="148" text="Employees:"/>
</mx:Panel>

Now that our user interface is setup and ready to go we can add our http services to go ask for the data from our php code. Now in flex you can setup all kinds of different services. We are just going to setup a simple http request service that sets a GET variable and tells the service that we want to run a function once we get the results. As you can see in the code below we send both services out to the same php page, which is the one we made earlier. Also each one sets one GET variable, which is done inside the mx:request block. Lastly, the result is an event which we hook to, to process the results of the request (our JSON data). This code goes at the very beginning of the file right after the Application opening element.

<mx:HTTPService id="personRequest"
        url="../files/json_tutorial.php"
        useProxy="false" method="GET" resultFormat="text"
        result="personJSON(event)">

    <mx:request xmlns="">
        <getPerson>"true"</getPerson>
    </mx:request>
</mx:HTTPService>
<mx:HTTPService id="managerRequest"
        url="../files/json_tutorial.php"
        useProxy="false" method="GET" resultFormat="text"
        result="managerJSON(event)">

    <mx:request xmlns="">
        <getManager>"true"</getManager>
    </mx:request>
</mx:HTTPService>

Ok, now let's get into the actual JSON decoding, which is really simple. So at this point if your using flex builder you will be getting a error message about an undefined method for personJSON(event) and managerJSON(event). We are going to solve that right now. First things first - lets just put in the method signatures so the application can build and run. The way this is done is by inputting a script tag and adding our actionscript functions inside there. You'll notice we added two import statements to import our JSON serialization functions and use the result event. This code will go right above the http services we just setup and below the Application opening element.

<mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    import com.adobe.serialization.json.JSON;
   
    private function personJSON(event:ResultEvent):void
    {
    }
   
    private function managerJSON(event:ResultEvent):void
    {
    }
    ]]>
</mx:Script>

Now down to the actual work of our application, the first thing we need to do in both of the functions is get the result back and we store it in a string. The next thing we do is call the function JSON.decode on the string, this function will return us an object with all the same properties of the one sent by php - we set this equal to a variable. We can now use this object and reference the properties using the . (dot) notation. So to get the first name of the person we simply use variable.first_name and so on for the rest of the variables. So that takes care of getting a person. And the above code is changed like so.

<mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    import com.adobe.serialization.json.JSON;
   
    private function personJSON(event:ResultEvent):void
    {
        //get the raw JSON data and cast to String
        var rawData:String = String(event.result);
        var person = JSON.decode(rawData);
        txtName.text = person.first_name + " " +
                  person.last_name;
        txtEmail.text = person.email;
        txtAddress.text = person.address;
        txtEmployees.text = "No";
        txtTitle.text = "No Title";
    }
   
    private function managerJSON(event:ResultEvent):void
    {
        //get the raw JSON data and cast to String
        var rawData:String = String(event.result);
        var manager = JSON.decode(rawData);
        txtName.text = manager.first_name + " " +
                  manager.last_name;
        txtEmail.text = manager.email;
        txtAddress.text = manager.address;
        txtEmployees.text = "Yes";
        txtTitle.text = manager.title;
    }
    ]]>
</mx:Script>

This takes care of all the text boxes we created and puts the correct values in them. Now we have to worry about that datagrid we created, and you might have noticed we haven't dealt with the employees of the manager yet. Well this is handled pretty nicely in the manager function. We are going add a new var called employees and this will be an Array. Because of the JSON.decode function we can simply cast the employees as an Array and all will be fine. The next thing we do is actually create an ArrayCollection to use for the data provider for the datagrid. This is a best practice when using array data for the provider because the ArrayCollection allows for some extra functionality. The final setup is to set the dataGrid.dataProvider equal to the ArrayCollection. Also we set the dataProvider equal to null in the person function to clear our the data in the data grid. To make all this work we also need to add another import for ArrayCollection. This leaves us with the following code.

<mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    import com.adobe.serialization.json.JSON;
   
    private function personJSON(event:ResultEvent):void
    {
        //get the raw JSON data and cast to String
        var rawData:String = String(event.result);
        var person = JSON.decode(rawData);
        txtName.text = person.first_name + " "
            + person.last_name;
        txtEmail.text = person.email;
        txtAddress.text = person.address;
        txtEmployees.text = "No";
        txtTitle.text = "No Title";
       
        //Data Grid Code
        dgEmployees.dataProvider = null;
    }
   
    private function managerJSON(event:ResultEvent):void
    {
        //get the raw JSON data and cast to String
        var rawData:String = String(event.result);
        var manager = JSON.decode(rawData);
        txtName.text = manager.first_name + " "
            + manager.last_name;
        txtEmail.text = manager.email;
        txtAddress.text = manager.address;
        txtEmployees.text = "Yes";
        txtTitle.text = manager.title;
       
        //Data Grid Code
        var employees:Array =
            manager.employees as Array;
        var employeesCollection:ArrayCollection =
            new ArrayCollection(employees);
        dgEmployees.dataProvider = employeesCollection;
    }
    ]]>
</mx:Script>

Now you might have tried it at this point and said "Hey, this isn't working!", well that is true. This is because we never hooked our buttons up to send the requests. This is really simple, we just add click events for both buttons and the corresponding service.send() commands to the click events. The code below is our new button code.

<mx:Button x="116" y="338" label="Get Employee"
    id="getPerson" click="personRequest.send();"/>

<mx:Button x="266" y="338" label="Get Manager"
    id="getManager" click="managerRequest.send();"/>

So this leaves us with the final flex code. This along with the php code at the beginning of the tutorial allows for JSON data to be sent to your flex applications.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute" width="500" height="410"
    viewSourceURL="../files/JSONTutorial.mxml">

<mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    import com.adobe.serialization.json.JSON;
   
    private function personJSON(event:ResultEvent):void
    {
        //get the raw JSON data and cast to String
        var rawData:String = String(event.result);
        var person = JSON.decode(rawData);
        txtName.text = person.first_name + " "
            + person.last_name;
        txtEmail.text = person.email;
        txtAddress.text = person.address;
        txtEmployees.text = "No";
        txtTitle.text = "No Title";
       
        //Data Grid Code
        dgEmployees.dataProvider = null;
    }
   
    private function managerJSON(event:ResultEvent):void
    {
        //get the raw JSON data and cast to String
        var rawData:String = String(event.result);
        var manager = JSON.decode(rawData);
        txtName.text = manager.first_name + " "
            + manager.last_name;
        txtEmail.text = manager.email;
        txtAddress.text = manager.address;
        txtEmployees.text = "Yes";
        txtTitle.text = manager.title;
       
        //Data Grid Code
        var employees:Array =
            manager.employees as Array;
        var employeesCollection:ArrayCollection =
            new ArrayCollection(employees);
        dgEmployees.dataProvider = employeesCollection;
    }
    ]]>
</mx:Script>

<mx:HTTPService id="personRequest"
        url="../files/json_tutorial.php"
        useProxy="false" method="GET" resultFormat="text"
        result="personJSON(event)">

    <mx:request xmlns="">
        <getPerson>"true"</getPerson>
    </mx:request>
</mx:HTTPService>
<mx:HTTPService id="managerRequest"
        url="../files/json_tutorial.php"
        useProxy="false" method="GET" resultFormat="text"
        result="managerJSON(event)">

    <mx:request xmlns="">
        <getManager>"true"</getManager>
    </mx:request>
</mx:HTTPService>
<mx:Panel x="0" y="0" width="500" height="410"
    layout="absolute" title="Simple JSON Example">

    <mx:DataGrid x="10" y="174" width="460" enabled="true"
        editable="false" id="dgEmployees">

        <mx:columns>
            <mx:DataGridColumn headerText="First Name"
                dataField="first_name"/>

            <mx:DataGridColumn headerText="Last Name"
                dataField="last_name"/>

            <mx:DataGridColumn headerText="Email"
                dataField="email"/>

            <mx:DataGridColumn headerText="Address"
                dataField="address"/>

        </mx:columns>
    </mx:DataGrid>
    <mx:Button x="116" y="338" label="Get Employee"
        id="getPerson" click="personRequest.send();"/>

    <mx:Button x="266" y="338" label="Get Manager"
        id="getManager" click="managerRequest.send();"/>

    <mx:Label x="131" y="12" text="Name"/>
    <mx:TextInput x="189" y="10" id="txtName" editable="false"/>
    <mx:Label x="131" y="42" text="E-mail"/>
    <mx:TextInput x="189" y="40" id="txtEmail" editable="false"/>
    <mx:Label x="131" y="68" text="Address"/>
    <mx:TextInput x="189" y="66" id="txtAddress"
        editable="false"/>

    <mx:Label x="131" y="94" text="Title"/>
    <mx:TextInput x="189" y="92" id="txtTitle" editable="false"/>
    <mx:Label x="131" y="122" text="Has Employees"/>
    <mx:TextInput x="229" y="120" width="120" editable="false"
        id="txtEmployees" text="No"/>

    <mx:Label x="10" y="148" text="Employees:"/>
</mx:Panel>
</mx:Application>




Posted in PHP, Flex, All Tutorials by The Fattest |

41 Responses

  1. Mike Potter Says:

    This is a great tutorial, thanks!

    Would you mind if we published this on the Flex developer center? Please let me know if that would be OK?

    Thanks,

    Mike

  2. The Fattest Says:

    Yeah Mike that would be fine. Thanks.

    Also look for an about us page here soon.

  3. Thomas Decaux Says:

    Hi,

    Thanks for your article, I was looking for make an RPC with Flex and PHP (using symfony framework) and now it works really good !

    There is the code I used for calling a symfony action (MVC pattern …) with some argument (arg0 is for identification) :

    public function invoke (url:String, callback:Function, args:Array = null):void
    {
    var loader:URLLoader = new URLLoader();
    configureListeners(loader);

    // Prepare arg string
    var argString:String = “?arg0=security_code”;

    if (args != null) {

    // Match ob_name needed with data loaded
    args.forEach(function (item:String, index:Number, arr:Array):void {

    argString += “&arg” + (index+1) + “=” + item;

    });

    }

    var request:URLRequest = new URLRequest(”../” + url + argString);

    this.callback = callback;

    request.method = URLRequestMethod.POST;
    loader.load(request);
    }
    ————————————-
    myRPC.invoke(”object/delete”, onResult, [3, ‘Laura’]);

    private function onResult(result : Object, status:int) : void
    {
    if (result != “OK”) {
    Alert.show(result as String, “Message”);
    }
    }

    Hope its can be useful !

  4. Selvaraj Says:

    Hey i need your help to connect MYSQL and Flex Please help me i cant understand from this. Please contact ur contact mail id. selvarajharley@yahoo.co.in is my mail id

  5. Selvaraj Says:

    i have one server with MYSQL support in that in need to integrate with that if u give ur mail id i can contact u easliy

  6. nwebb Says:

    Hi guys. Very nice introduction, clearly written. Thanks :)

  7. The Fattest Says:

    Selvaraj, sorry for late response I was out of town. You can send a detailed description of your needs to our contact e-mail on the About Us page and we will see what can be done.

  8. Anthony Says:

    Thanx to Fastest for the nice tutorial.Is there any way I could do the opposite of what u have done.By this am and have been trying for some time to send an array of actionScript class object to PHP.
    This is what i mean
    Person.as is an AS class
    In the same Flex project I have the main MXML file that has an array of Person objects declared like this:
    var people:Array = new Array()
    Finally I would like to send this entire array to a PHP script
    Thanx in advance

  9. Mine is not working, i get the following error Says:

    Can you please help me with it? I can send my project actually it is what i see above.
    (My server support JSON)
    best
    selcukartut
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.adobe.serialization.json::JSONDecoder/::parseValue()
    at com.adobe.serialization.json::JSONDecoder$iinit()
    at com.adobe.serialization.json::JSON$/decode()
    at demo/::personJSON()
    at demo/__personRequest_result()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    at ::DirectHTTPMessageResponder/completeHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()

  10. The Fattest Says:

    Mr Mine,
    Here is what I would suggest. First, go to the php page that your pulling data from directly from your browser. So in our case it would be http://blog.paranoidferret.com/files/json_tutorial.php?getPerson=true
    this should return some JSON encode data, and you will be able to see this in the browser window. If the data isn’t showing up the problem lies in the php code. If it does show up then the next step I would suggest is to run the debugger on your flex with a break point right before you call JSON.decode; now you can check out what event.result is set to. If these suggestions don’t help out, let me know and at that point I will have to see some code.

  11. selcukartut Says:

    thanks a lot,
    it worked well, however i could make a progress with Using Flex, PHP, and JSON to Modify a MySQL Database tutorial. I get the following error;
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.adobe.serialization.json::JSONDecoder/::parseValue()
    at com.adobe.serialization.json::JSONDecoder$iinit()
    at com.adobe.serialization.json::JSON$/decode()
    at jsonlusuz/::getPHPData()
    at jsonlusuz/__getData_result()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    at ::DirectHTTPMessageResponder/completeHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()

    here is the website:http://x.rproduksiyon.com/test/jsonlusuz.html

    thanks a lot for your help.
    best
    selcukartut

  12. mike Says:

    Is using cold fusion easier?

  13. The Fattest Says:

    Mike,
    Using cold fusion is probably easier, but I can’t say for sure because I’ve never used cold fusion. From what I’ve heard Flex/Actionscript are tightly integrated with cold fusion so this task would probably be easier.

  14. jaime Says:

    Houston we have a problem !!!

    please,

    in line
    var person = JSON.decode(rawData);

    in flex follow error “!1008 var person,no tiene declaracion de tipo “.

  15. The Fattest Says:

    My spanish is not as good as it used to be but the error is simple to fix and really should show up as a warning.

    Use:
    var persion:Object = JSON.decode(rawData);

    That should take care of it.

  16. jaime Says:

    No work

    var person:Object = JSON.decode(rawData);

    be repeat the same error

    “person No have declaration of type”

    please
    thx

  17. The Fattest Says:

    Well I am not sure what the issue would be but if you can show a little more of the code around the problem area. I will try to help figure it out.

  18. jaime Says:

    hi, it’s your same code (copy and paste) without modifications.

    i have use wamp php 5.2.5,

    apache 2.2.6

    i’m just star in flex

    THX

  19. jaime Says:

    in the same code line other error

    “access to a property JSON non defined”

    thx

  20. The Fattest Says:

    What version of flex are you using? And are you sure you have the corelib added to your project correctly to make sure that JSON.decode works?

  21. jaime Says:

    Now is working the problem was bad import corelib, thanks.

    this example is very clear, now I learn to use JSON.

    thank you very much

  22. jaime Says:

    I fix error, was JSON bad add

    thx

  23. Brayn Says:

    Cant get it work, i have also 2 warnings. The same 1008. Need to now how i can see if i have bad add of corelib and if that is the problem, because the fix give me more errors.

    thnx

  24. Otuyelu Says:

    Oh my, thanks for this very clear and concise tutorial. I am going to subscribe to your RSS syndication. Read your article at http://www.adobe.com/devnet/flex/articles/flex_php_json.html

    Thanks once again!

  25. Javlae Says:

    hei thanks for this tutorial. it will save a lot of time cos i’ve been parsing xmls all the time!!!

    i imported the .swc of corelib 0.90, using Flex Builder 2.0.1, php 5.2.3 and running the test on localhost. and i am doing everything as you said (as far as i know).

    first i got the “Error #2148: ” that says that “Only local-with-filesystem and trusted local SWF files may access local resources”

    i tried correcting this by adding “-use-network=false” to the flex compiler proyect properties.

    But then the error is

    Error: Unexpected

  26. Javlae Says:

    Error: Unexpected

  27. Javlae Says:

    Ok this is not working!

    Error: Unexpected (less than character) encountered
    at com.adobe.serialization.json::JSONTokenizer/parseError()
    at com.adobe.serialization.json::JSONTokenizer/getNextToken()

    from the JSONToken.as

    i think this is because by adding the line i added, php is simply not working and the parser is reading the first ‘(less than)’ char from the php file: ‘(less than character)?php’

    Is there another way to correct the error? do i HAVE to test it online? Why doesn’t it work on localhost?

    Thanx for taking the time to do great stuff for all of us rookies!

    and sorry for so many posts but this sign is kinda tricky

  28. Dragan Says:

    HI, I have problems transmitting UTF-8 characters form Flex to php. I am getting some sort of wired characters. I don’t know what’s that for. Is it from JSON encode function in Flex, or it’s from flex. Can someone help me, its very important.
    Please,
    Best greetings,
    Dragan :)

  29. The Fattest Says:

    Javlae,
    Yes the php code needs to be running on a php server, this could be a local server but you need to make sure you’re using the correct url for your localhost.

    Dragan,
    It looks like PHP’s json_encoding doesn’t utf8 encode the data before sending it. I would recommend running any strings with special characters through PHP’s utf8_encode before json encoding.

    For going from Flex to PHP you probably want to base64 encode the string with the special characters in Flex and then decode then in PHP. So this would look something like this:

    var be:Base64Encoder = new Base64Encoder();
    var s:String = “Däoeö”;
    s = be.encodeUTFBytes(s)

    and now s is your new value string. Does this make sense? If not I will write up a quick sample to illustrate this.

  30. bagley Says:

    Really good example, thx

  31. Scott Norland Says:

    Thanks! Very helpful for an AJAX (really AJAJ - since I’m mostly use JSON) guy like myself starting out in flex.

  32. n24jsk Says:

    the fattest, I actually done ur tutorial, but I have a litle problem with the UTF8 encoding by the flex side(PHP it-s ok), so I appreciate if yu could give me a litle help there, thanks

    Pd. doing what you do in a post, about base64encode…it gives me a undefinded value to each string where I apply it…

  33. Me Says:

    http://www.adobe.com/devnet/flex/articles/flex_php_json.html

    Mmmmm, weird, the same article!

  34. The Reddest Says:

    It is the same article. The guy in the picture is The Fattest. Adobe contacted us about publishing a couple of our Flex tutorials in their developer center. Here’s one of our posts explaining it a little more.

  35. khanh Says:

    an excellent and well written tutorial. Thanks for sharing this.

  36. Ankur Says:

    Step wise specification helped me a lot in understanding Flex with JSON and PHP. Thanks so much!

  37. mani Says:

    hi I am trying to load webservice return data
    dynamically into datagrid at runtime using actionscript.
    But my datagrid shows empty andis not able to display any data?
    Can you suggest why ???

  38. The Fattest Says:

    mani I would need to see some code to help you out.

  39. Robalinho Says:

    TypeError: Error #1034: Type Coercion failed: cannot convert “{”first_name”:”Jacob”,”last_name”:”D\u00e4oe\u00f6″,”email”:”fake@email.com”,”address”:”5555 Some Street City, State 55555″}” to com.adobe.serialization.json.JSONDecoder.

    hi I am trying to use this example but appear to have errors in Decode. Can you help me?

Tracebacks / Pingbacks


  1. nookli » Blog Archive » Flex & PHP Tutorial - Transmitting data using JSON


  2. Giant Flying Saucer » Blog Archive » Getting Flash CS3 talking to PHP 5 via JSON


Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Powered by WP Hashcash