Menu

amfphp is killing me slowly

Help
2015-07-21
2015-07-22
  • Reggie The Dog

    Reggie The Dog - 2015-07-21

    I've downloaded amfphp 2.2.1 and its installed and working in the sense that I can get the return "« hello world from the server »"; response ttraced in Flash cs4 IDE. Unfortunately all examples on the web centre around earlier versions so I'm completely lost. problems thus far:
    1. When I creat a public function __construct() for creating a PDO connection to my database it does not work. However, when I copy,paste the same lines from the construct into the function I am writing it works. which leads me to my next problem
    2. I can get the data from my query using the method
    public function getBds(){
    $con = new PDO('mysql:host=localhost;dbname=db;charset=utf8', 'MySQLConnect','MyConn');
    $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
    $con->setAttribute( \PDO::ATTR_EMULATE_PREPARES, false);
    $sqlQ = "SELECT * FROM buildings";

    From the flash ID via
    function handleResult(respond:Object):void{
    trace("the server said : " + respond);
    the trace results shows many [object Object] which is great. I'm getting data. Fantastic!

    How do I get to read this data into Flash? From the few tutorials (which only use mysql_query) I've tried var h:Array = respond.serverInfo.initialData; but tihs just throws the error - TypeError: Error #1010: A term is undefined and has no properties.
    at amf_fla::MainTimeline/handleResult();

    Totally in the dark, and after 8 hours of plugging away at this, I'm failing to make any headway... All searches on the web reveal stuff that is circa 6-7 years old...

    Looking forward to some guidance
    PS. I'm not a developer so be gentle with me.. amfphp hold great promise for me so I'm really keen to get this to work

     
    • ariels

      ariels - 2015-07-21
      1. This seems weird. Post some code and share some details.
      2. Do you have any idea what your server is returning? In your function if
        you returned an array, for example, you should get that very same array in
        Flash. This means that in your code, respond should be that array.
        Now if you don't mind learning a new tool, I suggest looking at what is
        going between your client and server. This is invaluable for debugging.
        http://www.silexlabs.org/amfphp/documentation/using-a-packet-sniffer/
        Also of interest
        http://www.silexlabs.org/amfphp/documentation/troubleshooting-and-debugging-your-project/

      hope this helps.

      Also, support for Amfphp is usually done on Stack Overflow, as described
      here

      http://www.silexlabs.org/amfphp/documentation/getting-help/

      Kind regards,
      Ariel Sommeria-Klein
      team lead for Amfphp

      On Tue, Jul 21, 2015 at 1:10 PM, Reggie The Dog <reggie-the-dog@users.sf.net

      wrote:

      I've downloaded amfphp 2.2.1 and its installed and working in the sense
      that I can get the return "« hello world from the server »"; response
      ttraced in Flash cs4 IDE. Unfortunately all examples on the web centre
      around earlier versions so I'm completely lost. problems thus far:
      1. When I creat a public function __construct() for creating a PDO
      connection to my database it does not work. However, when I copy,paste the
      same lines from the construct into the function I am writing it works.
      which leads me to my next problem
      2. I can get the data from my query using the method
      public function getBds(){
      $con = new PDO('mysql:host=localhost;dbname=db;charset=utf8',
      'MySQLConnect','MyConn');
      $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
      $con->setAttribute( \PDO::ATTR_EMULATE_PREPARES, false);
      $sqlQ = "SELECT * FROM buildings";

      From the flash ID via
      function handleResult(respond:Object):void{
      trace("the server said : " + respond);
      the trace results shows many [object Object] which is great. I'm getting
      data. Fantastic!

      How do I get to read this data into Flash? From the few tutorials (which
      only use mysql_query) I've tried var h:Array =
      respond.serverInfo.initialData; but tihs just throws the error - TypeError:
      Error #1010: A term is undefined and has no properties.
      at amf_fla::MainTimeline/handleResult();

      Totally in the dark, and after 8 hours of plugging away at this, I'm
      failing to make any headway... All searches on the web reveal stuff that is
      circa 6-7 years old...

      Looking forward to some guidance
      PS. I'm not a developer so be gentle with me.. amfphp hold great promise
      for me so I'm really keen to get this to work


      amfphp is killing me slowly
      https://sourceforge.net/p/amfphp/discussion/247252/thread/aef2eda3/?limit=25#a636


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/amfphp/discussion/247252/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      cordialement,
      Ariel Sommeria-Klein

       
      • Reggie The Dog

        Reggie The Dog - 2015-07-21

        @ariels - Its probably me. I'm probably doing something stupid but thank you so much for getting back to me so quickly. I used Charles proxy and it shows there is definitely data coming back and it is the data that I query.
        amfphp - 2.2.1
        OS windows 7 pro with IIS 7
        PHP 5.3.29

        So, attached - screenshot of the Charles output
        attached - CS4 output

        I am so utterly in the dark here

         

        Last edit: Reggie The Dog 2015-07-22
        • ariels

          ariels - 2015-07-22

          sorry, I didn't receive any attachment. Maybe you can't post attachlments
          to the mailing list, I don't know.
          Anyway, do you realize you can generate a client stub to get you through
          this kind of issue?
          It's in backoffice/client generator, as described here
          http://www.silexlabs.org/amfphp/documentation/using-the-back-office/

          On Tue, Jul 21, 2015 at 7:30 PM, Reggie The Dog <reggie-the-dog@users.sf.net

          wrote:

          Its probably me. I'm probably doing something stupid but thank you so much
          for getting back to me so quickly. I used Charles proxy and it shows there
          is definitely data coming back and it is the data that I query.
          amfphp - 2.2.1
          OS windows 7 pro with IIS 7
          PHP 5.3.29

          So, attached - screenshot of the Charles output

          I am so utterly in the dark here

          amfphp is killing me slowly
          https://sourceforge.net/p/amfphp/discussion/247252/thread/aef2eda3/?limit=25#a636/4293/ae1d


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/amfphp/discussion/247252/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/

          --
          cordialement,
          Ariel Sommeria-Klein

           
  • Reggie The Dog

    Reggie The Dog - 2015-07-22

    Thanks for the reply. To help you help me I've posted the proxy screenshot on stackoverflow - http://stackoverflow.com/questions/31560132/cannot-view-data-returned-by-amfphp

    Sorry, although I've read the page you suggested I'm still not clear on how to create a client stub. Also I'm confused how this stub would get around the Flash error I keep getting which is as follows

    TypeError: Error #1010: A term is undefined and has no properties.
    at amf_fla::MainTimeline/handleResult()

    Once I can see this data clearly in Flash and am able to display it in the end user it will be a massive leap forward. I'm really keen to get amfphp working as it would provide great benefit to the project that I've been working on but again I'm really struggling.. perhaps I'm being too ambitious!?

     

Log in to post a comment.