3 Replies Latest reply on Jan 16, 2009 7:30 AM by Newsgroup_User

    Flex connects to PHP concept confused

    Smile2JP
      Hello,

      I'm reading some articles about how to connect to server using flex and php. But I'm confused right now.
      When should I use crossdomain.xml and when should I use AMFPHP?
      Does that mean I only need to choose one method to use?

      Thank you.
        • 1. Re: Flex connects to PHP concept confused
          Level 7

          "Smile2JP" <webforumsuser@macromedia.com> wrote in message
          news:gkmmjd$cs1$1@forums.macromedia.com...
          > Hello,
          >
          > I'm reading some articles about how to connect to server using flex and
          > php.
          > But I'm confused right now.
          > When should I use crossdomain.xml and when should I use AMFPHP?
          > Does that mean I only need to choose one method to use?

          You should use crossdomain.xml when your swf is on a different server from
          your php script.

          You should use AMFPHP (or ZenD, or some other remoting technology) when you
          want to return objects from PHP that already have the same data type as your
          Flex class.

          For more on this:
          http://www.insideria.com/2008/04/amf3-php-server-objects-to-fle.html

          To see it in action:
          http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html

          HTH;

          Amy


          • 2. Re: Flex connects to PHP concept confused
            Smile2JP Level 1
            Hi Amy,

            Thank you for your reply. Useful information. But I still have one question. Hope you could help me.

            Now I'm developing a web flex application including a function which is the user can take a snapshot and save the image via a webcam. I publish the swf file in my local computer just for testing. And the php file is on the server. So do I need to create a "crossdomain.xml" on the server?

            Thanks again.
            • 3. Re: Flex connects to PHP concept confused
              Level 7

              "Smile2JP" <webforumsuser@macromedia.com> wrote in message
              news:gkpanq$ija$1@forums.macromedia.com...
              > Hi Amy,
              >
              > Thank you for your reply. Useful information. But I still have one
              > question.
              > Hope you could help me.
              >
              > Now I'm developing a web flex application including a function which is
              > the
              > user can take a snapshot and save the image via a webcam. I publish the
              > swf
              > file in my local computer just for testing. And the php file is on the
              > server.
              > So do I need to create a "crossdomain.xml" on the server?

              If your ultimate goal is to put the php on one server and the swf on
              another, yes. If not, no.

              When you're testing from your machine, usually Flex handles the permissions
              by setting the sandbox for your workspace so it will just work. The
              exception is if you've told Flex to publish somewhere else, such as
              C:\wamp\www\, for example.

              HTH;

              Amy