Bind your outgoing data to a model and submit that to the server:

<mx:Model id="infoModel">
<info>
<text2>{text1.text}</text1>
<text2>{text2.text}</text2>
<info>
</mx:Model>

Send it to the server via an HTTPService:

<mx:HTTPService
id="saveAny"
method="POST"
url=""http://yourserver/process.a">http://yourserver/process.a"
useProxy="false"
showBusyCursor="true">
</mx:HTTPService>

Send like this:
saveAny.send(infoModel);


Bind the incoming like this:

<mx:Form width="50%" height="100%">
<mx:FormHeading label="Standard Info"/>
<mx:FormItem label="Text 1">
<mx:TextArea id="text1" text="{generalInfo.lastResult.response.info.text1}"/>
</mx:FormItem>

<mx:FormItem label="Text 2">
 <mx:TextArea id="text2" text="{generalInfo.lastResult.response.info.text2}"/>
</mx:FormItem>

<mx:Form>

To a service like this:
<mx:HTTPService
    id="generalInfo"
    url=""http://yourserver/get">http://yourserver/get"
    useProxy="false">
</mx:HTTPService>


I use php, here's how I return the data. I put everything in an associate array then output it with a function:

$row['text1'] = "some data";
$row['text2'] = "some more data";

print "<?xml version=\"1.0\" ?>\n";
print "<response>";
print namedAssocToXml('info', $out);
print "</response>";

function namedAssocToXml($rowname, $attributes) {
$output = "<$rowname>\n";
foreach ($attributes as $name => $value) {
if (is_array($value)) {
if (is_numeric($name)) {
$output .= namedAssocToXml('row', $value);
}
else {
$output .= namedAssocToXml($name, $value);
}
}
else {
$value = str_replace("<", "&lt;", $value);
$value = str_replace(">", "&gt;", $value);
if (is_numeric($name)) {
$output .= "<item>" . $value . "</item>\n";
}
else {
$output .= "<$name>" . $value . "</$name>\n";
}
}
}
$output .= "</$rowname>\n";
return $output;
}


I think using HTTPService is the older model for doing things. With FDS you can do a lot of cooler things, but hopefully that will get you started. 

Nate


On Aug 24, 2006, at 11:09 AM, Mike Anderson wrote:

I will jump back into the Docs right away, but in the meantime, is there a faster way to do this?
 
Or must I do it the traditional way, by systematically assigning the values to the ValueObject, just prior to sending the Variables over to the server?
 
i.e.
 
myValueObjectVO.propertyOne = textFieldOne.text;
myValueObjectVO.propertyTwo = textFieldTwo.text;
myValueObjectVO.propertyThree = textFieldThree.text;
 
Thanks in advance!
 
Mike


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Matt Chotin
Sent: Thursday, August 24, 2006 12:32 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Don't bindings work both ways??

No, binding is only one-way, you’ll need to set up the 2-way yourself.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mike Anderson
Sent: Wednesday, August 23, 2006 9:56 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Don't bindings work both ways??

 

Hello All,

I have a Form with several fields - and those fields are all bound to a
ValueObject (using the Curly Braces method).

After doing my database calls, etc., my Form populates beautifully with
all the values. However, if I edit any of those fields on the Form, and
then send the same ValueObject back to the server, nothing is changed -
it's as if I didn't make any changes to the Form itself.

It was my understanding, that once a Binding Relationship is created,
that any changes (either in the Model itself, or the Fields that are
tied to the Model) will update in both directions.

Is this not true, or am I missing something?

Thanks all for your help,

Mike



__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to