Failing at Flex

View: New views
3 Messages — Rating Filter:   Alert me  

Failing at Flex

by smangold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I used amfphp with Flash AS2 quite happily for years. I have been trying
for some time to graduate to Flex and amfphp 1.9 but have not been
successful. I am trying to use the sephiroth tutorial. I have
successfully completed the Hello World tutorial and also successfully
passed a PHP array to Flex, using the instructions in the second part of
the tutorial.

Unfortunately for me, there is no third part of the tutorial which shows
how to pull data from a MySQL database. I am reasonably confident that I
am correctly accessing the database. But that's about it.

I created a MySQL database using the same data that is used in part 2 of
the tutorial. The part that I think is problematic is:

    if (!$Link) {
       printf("Can't connect to MySQL Server. Errorcode: %s\n",
mysqli_connect_error());
       exit;
    }
   
    if ($Link) {  
        $Result = array();
        $Query = "SELECT firstName, lastName, phone, email from $TableName";
        $result = mysql_query($Query);
       
           while ($row = mysql_fetch_array($result)) {
        $stuff = new Person();
        $stuff->firstName = $row['firstName'];
        $stuff->firstName = $row['lastName'];
        $stuff->firstName = $row['phone'];
        $stuff->firstName = $row['email'];
        $Result[] = $stuff;
}
return $Result;
        }
       
        mysql_close ($Link);

When I run the Flex application, I get a Deliveryindoubt error.

If I look at the service through the browser, I get:

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
    at RawAmfService/readData()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

Being new to Flex, I don't know how to begin to troubleshoot this thing.

Can someone help?

TIA.

Sue



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
amfphp-general mailing list
amfphp-general@...
https://lists.sourceforge.net/lists/listinfo/amfphp-general

Parent Message unknown Re: Failing at Flex

by Michael Ramirez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Susan,

There is a Flex and AMFPHP tutorial on How To Forge.


Michael Ramirez


----- Original Message ----
From: Susan Mangold <smangold@...>
To: amfphp-general@...
Sent: Friday, July 25, 2008 2:55:37 PM
Subject: [amfphp] Failing at Flex

I used amfphp with Flash AS2 quite happily for years. I have been trying
for some time to graduate to Flex and amfphp 1.9 but have not been
successful. I am trying to use the sephiroth tutorial. I have
successfully completed the Hello World tutorial and also successfully
passed a PHP array to Flex, using the instructions in the second part of
the tutorial.

Unfortunately for me, there is no third part of the tutorial which shows
how to pull data from a MySQL database. I am reasonably confident that I
am correctly accessing the database. But that's about it.

I created a MySQL database using the same data that is used in part 2 of
the tutorial. The part that I think is problematic is:

    if (!$Link) {
       printf("Can't connect to MySQL Server. Errorcode: %s\n",
mysqli_connect_error());
       exit;
    }
 
    if ($Link) {  
        $Result = array();
        $Query = "SELECT firstName, lastName, phone, email from $TableName";
        $result = mysql_query($Query);
     
           while ($row = mysql_fetch_array($result)) {
        $stuff = new Person();
        $stuff->firstName = $row['firstName'];
        $stuff->firstName = $row['lastName'];
        $stuff->firstName = $row['phone'];
        $stuff->firstName = $row['email'];
        $Result[] = $stuff;
}
return $Result;
        }
     
        mysql_close ($Link);

When I run the Flex application, I get a Deliveryindoubt error.

If I look at the service through the browser, I get:

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
    at RawAmfService/readData()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

Being new to Flex, I don't know how to begin to troubleshoot this thing.

Can someone help?

TIA.

Sue



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
amfphp-general mailing list
amfphp-general@...
https://lists.sourceforge.net/lists/listinfo/amfphp-general



     

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
amfphp-general mailing list
amfphp-general@...
https://lists.sourceforge.net/lists/listinfo/amfphp-general

Re: Failing at Flex

by dnk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 25-Jul-08, at 1:55 PM, Susan Mangold wrote:
>
> Unfortunately for me, there is no third part of the tutorial which  
> shows
> how to pull data from a MySQL database.

Susan,

Download the Adobe PHP RIA kit. There is an excellent, simple example  
in there that has a nice and to the point example pulling and  
inserting data with mysql.

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

That is what had gotten me going with flex/amfphp/mysql.

Dustin

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
amfphp-general mailing list
amfphp-general@...
https://lists.sourceforge.net/lists/listinfo/amfphp-general
LightInTheBox - Buy quality products at wholesale price!