调试中的Flex服务

时间:2010-04-24 17:17:23

标签: php flex service flash-builder

我正在尝试学习flex 4中的新服务方法,但我无法让它工作。 Flash Builder 4中服务附近的测试操作正常。但是,当我运行代码时,我得到NetConnection.Call.Failed:HTTP:失败。有人知道问题是什么吗?

汤姆

CODE:

PHP

 <?php 

class AuthService {
    public function login($username, $password) {
        return 'ok';
    }
    public function logout() {
        return true;
    }
}

?>

FLEX

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:authservice="services.authservice.*">
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;

            protected function button_clickHandler(event:MouseEvent):void
            {
                loginResult.token = authService.login(username, password);
            }

        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:CallResponder id="loginResult"/>
        <authservice:AuthService id="authService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Button x="97" y="193" label="Button" id="button" click="button_clickHandler(event)"/>
    <s:TextInput x="91" y="87" id="username"/>
    <s:TextInput x="97" y="117" id="password"/>
</s:Application

&GT;

1 个答案:

答案 0 :(得分:1)

检查php服务器端的crossdoamin设置。