2010-04-24 65 views
0

我正試圖學習flex 4中的新服務方法,但是我無法獲得它的工作。 Flash Builder 4中的服務附近的測試運行正常。但是當我運行代碼時,我得到NetConnection.Call.Failed:HTTP:失敗。有人知道問題是什麼嗎?調試中的Flex服務

湯姆

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 

>

回答

1

在php服務器端檢出您的crossdoamin設置。

+0

對不起,這沒有奏效。我在web根目錄下創建了一個文件,但沒有成功...... – Timo 2010-04-25 09:38:33