1 Reply Latest reply on Sep 19, 2008 6:09 PM by peterent

    phasing Flex

    Tom L
      I have an application written in php and mysql, which I would like to convert selected pages into Flex. It appears that I can essentially build, for want of a better term, "flex pages", each being a flex application. The question is, is this possible or a preferable way to do things considering I only want to convert only parts of the application to flex? Also if I was to develop a flex page can someone lead me in the direction of how code the passing of data into the flex page via a query string. Finally in looking at flex builder I didn't see any way to test such a page, that is to say, emulate passing in the query string from an external php page.
      Any advice would be appreciated.
        • 1. Re: phasing Flex
          peterent Level 2
          What you are asking is kind of advanced. You'd be better off starting with a good understanding of Flex and then applying that to your situation.

          For example, your PHP is probably generating HTML. You won't need that part when using Flex. Suppose your PHP code gets data from a database and builds an HTML <table>. You don't want the part that builds that HTML but you do want the part that reads the database.

          Instead of creating the HTML for the table, the PHP script should produce XML. The Flex app will request the XML (using HTTPService) and fill a Flex DataGrid with the result.

          For you last question: go to the Run menu and open the Run (or Debug) dialog box. Select your application from the list and uncheck the box about using the default values. There are 3 entries: one for Run, on for Debug, and one for Profile. Pick Debug, for example, and modify the URL.

          Next, open the html-template directory and modify the index template. You'll need to use some JavaScript to extract the query parameters from the request and pass them as FlashVars to the Flex script.

          A quicker alternative is to open the index template and simply add your query parameters to the ${swf} to make it something like: ${swf}?param=value&param=value and so forth. I honestly don't know if that will work, but it should.

          Inside of the Flex application, the <mx:Application> class as a parameters property. Each of the values in the query string will be a property of parameters:

          var userName:String;
          if( parameters.hasProperty("user") ) userName = parameters["user"];

          If you have ${swf}?user=test

          At least that's the idea. Hope this helps.