2 users online. Create an account or sign in to join them.Users

Search

there are no threads about how to integrate symphony with flex/flash builder. i tried to do it today but i got stuck, so i’m asking for help!

i have a simple messages section with one text area. i also have a page that includes a “createmessage” event and the from looks like this:

<form method="post" action="" enctype="multipart/form-data">
      <input name="MAX_FILE_SIZE" type="hidden" value="5242880" />
      <textarea name="fields[message]" rows="3" cols="50"></textarea>
      <input name="action[create-message]" type="submit" value="Submit" />
</form>

now, i want to send data with this form from a flex app, and this is how my flex app looks:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx" width="350" height="443">

    <fx:Declarations>
        <mx:HTTPService id="sendMessage" method="POST" url="http://localhost/test/sendmessage" useProxy="false">
            <mx:request xmlns="">
                <fields[message]>{inputmessage.text}</fields[message]/>
                <action[create-message]>Submit</action[create-message]>
            </mx:request> 
        </mx:HTTPService>
    </fx:Declarations>

    <s:TextInput id="inputmessage" height="117" left="10" right="10" top="10" textAlign="left"/>
    <s:Button y="135" label="Button" id="postbtn" click="sendMessage" horizontalCenter="7" width="70"/>

</s:WindowedApplication>

it’s a very simple app. it has only an input text and a button…

i gues there are 2 ways to send the data: - using flex mxml… which i tried in the example above - with an as3 function that will do all the job…

my problem is: - i get an error if i try to use fields[message] and action[create-message] in flex, i have to rename them to something that doesn’t include: [] or write them in a diferent way.

anyone, any ideas?

while waiting for your ideeas i made the as3 version…

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx" width="350" height="443">

    <fx:Script>
        <![CDATA[

                    private var scriptRequest:URLRequest;
                    private var scriptLoader:URLLoader;
                    private var scriptVars:URLVariables;

                    private function post_message(event:MouseEvent):void {

                        scriptRequest = new URLRequest("http://localhost/test/sendmessage/");
                        scriptLoader = new URLLoader();
                        scriptVars = new URLVariables();                

                        scriptRequest.method = URLRequestMethod.POST;
                        scriptRequest.data = scriptVars;

                        scriptVars['fields[message]'] = inputmessage.text;
                        scriptVars['action[create-message]'] = 'Submit';
                        scriptLoader.load(scriptRequest);
                    }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <s:TextInput id="inputmessage" height="27" left="78" right="78" top="111" textAlign="left"/>
    <s:Button y="158" label="Button" id="btn" click="post_message(event)" horizontalCenter="0" width="70"/>

</s:WindowedApplication>

After googling a bit, it turns out that you ‘re not the only one facing the problem.

A quick way to solve this is to remap whatever params you manage to send from flex within your event (brutally populating the php $_POST array) so that symphony could understand them.

Another great way to solve this is to not use Flash.

ohnohedidn’t!

what do you mean “not use Flash”? i used only as3 and flash builder… ex flex builder.

if you mean to keep it html… well, i like the ideea to get on users desktops with air or mobiles as app… ;)

alpacaaa thanks for the link, hope it will solve my problem…

i like the idea to get on users desktops with air or mobiles as app

Out of curiosity, what mobile platforms are you targeting for your flex app?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details