开发者

HHTTPService Error

I'm trying to debug an issue by going to the most basic of tasks.

I have an app written in adobe flex (action script 3) that I want to have interact with a web service. Because it appears I can't access the server, I've created a simple app.

Source code for the ActionScript

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">
    <mx:HTTPService id="concat" url="concat.php" resultFormat="text" method="POST">
        <mx:request xmlns="">
            <stringOne>{stringOne.text}</stringOne>
            <stringTwo>{stringTwo.text}</stringTwo>
        </mx:request>
    </mx:HTTPService>

    <mx:VBox top="10" left="10">
        <mx:HBox verticalAlign="middle">
            <mx:Label text="String 1:"/>
            <mx:TextInput id="stringOne"/>
        </mx:HBox>
        <mx:HBox verticalAlign="middle">
            <mx:Label text="String 2:"/>
            <mx:TextInput id="stringTwo"/>
        </mx:HBox>
        <mx:HRule width="100%"/>
        <mx:Button label="Concatenate!" click="concat.send()"/>
        <mx:Text fontSize="14" text="{concat.lastResult}"/>
    </mx:VBox>

</mx:Application>

Code for the PHP

<?php

$stringOne = $_POST['stringOne'];
$stringTwo = $_POST['stringTwo'];

print $stringOne . $stringTwo;

?>

When I fill in the fields and pr开发者_如何学Pythoness the button nothing happens. Ideas? Thoughts? Suggestions?


try this one and let us know:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">
    <mx:HTTPService id="concat" url="concat.php" resultFormat="text" method="POST" fault="mx.controls.Alert.show(event.fault.faultString)" result="mx.controls.Alert.show(event.result.toString())">
        <mx:request xmlns="">
            <stringOne>{stringOne.text}</stringOne>
            <stringTwo>{stringTwo.text}</stringTwo>
        </mx:request>
    </mx:HTTPService>

    <mx:VBox top="10" left="10">
        <mx:HBox verticalAlign="middle">
            <mx:Label text="String 1:"/>
            <mx:TextInput id="stringOne"/>
        </mx:HBox>
        <mx:HBox verticalAlign="middle">
            <mx:Label text="String 2:"/>
            <mx:TextInput id="stringTwo"/>
        </mx:HBox>
        <mx:HRule width="100%"/>
        <mx:Button label="Concatenate!" click="concat.send()"/>
        <mx:Text fontSize="14" text="{concat.lastResult}"/>
    </mx:VBox>

</mx:Application>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜