2011-08-04 181 views
0

首先,這裏是我得到確切的錯誤:幫助,錯誤1061 - 調用可能未定義的方法

Error 1061: Call to a possibly undefined method _initRemoteClassAlias through a reference with a static type Class

所以,他這樣說,這裏就是我想我知道。正打算調用一個名爲_initRemoteClassAlias的方法,但找不到它。所以這裏是我的猜測,我的困惑/問題出現在哪裏。它試圖調用的方法是由FlashBuilder在我編寫的PHP腳本的_Super類中自動創建的。 (在這種情況下,錯誤是由詞幹:services.cascobackend._Super_CASCOBackend.as) - 這裏有一個代碼從_Super類問題的第一點點:

package services.cascobackend 
{ 
import com.adobe.fiber.core.model_internal; 
import com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper; 
import com.adobe.serializers.utility.TypeUtility; 
import mx.rpc.AbstractOperation; 
import mx.rpc.AsyncToken; 
import mx.rpc.remoting.Operation; 
import mx.rpc.remoting.RemoteObject; 
import valueObjects.Ticket; 

import mx.collections.ItemResponder; 
import com.adobe.fiber.valueobjects.AvailablePropertyIterator; 

[ExcludeClass] 
internal class _Super_CASCOBackend extends com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper 
{ 

// Constructor 
public function _Super_CASCOBackend() 
{ 
    // initialize service control 
    _serviceControl = new mx.rpc.remoting.RemoteObject(); 

    // initialize RemoteClass alias for all entities returned by functions of this service 
    valueObjects.Ticket._initRemoteClassAlias(); 

    var operations:Object = new Object(); 
    var operation:mx.rpc.remoting.Operation; 

    operation = new mx.rpc.remoting.Operation(null, "throwExceptionOnError"); 
    operation.resultType = Object; 
    operations["throwExceptionOnError"] = operation; 
    operation = new mx.rpc.remoting.Operation(null, "getTicketsByUser"); 
    operation.resultElementType = valueObjects.Ticket; 
    operations["getTicketsByUser"] = operation; 

    _serviceControl.operations = operations; 
    _serviceControl.convertResultHandler = com.adobe.serializers.utility.TypeUtility.convertResultHandler; 
    _serviceControl.source = "CASCOBackend"; 
    _serviceControl.endpoint = "http://localhost/CMphp/public/gateway.php"; 


    preInitializeService(); 
    model_internal::initialize(); 
} 

和特定行中的出錯是發生在IS :

valueObjects.Ticket._initRemoteClassAlias(); 

在應用程序中我做了(顯然)命名的值對象票證衆生像這樣:

package valueObjects 
{ 
[Bindable] 
[RemoteClass(alias="Ticket")] 

public class Ticket 
{ 
     public var ticketid:int; 
     public var ticketNumber:String; 
etc... 
etc... 

的PHP函數,它引用SIMP LY抓住某些參數的所有項目,並返回結果作爲獨立的票券項目這樣的票務[]數組:

... 
     mysqli_stmt_execute($stmt); 
    $this->throwExceptionOnError(); 

    $rows = array(); 
    $row = new Ticket(); 

    mysqli_bind_result($stmt, $row->ticketid, etc... 

而且 - 當我在FlashBuilder運行此功能的測試,它返回的項目,就像我期望,甚至會出現關於_initRemoteClassAlias顯示的錯誤。如果我只是註釋掉那條線,那麼代碼在運行時不會返回任何東西(儘管它在FB中測試時仍然返回值)

所以 - 我已經搞亂了這個HOURS並且四處尋找答案,但我沒有想法。希望你有一些!

在此先感謝您的幫助! -CS

編輯:::編輯:::

好了 - 下面是創建Flex的整個_Super代碼:

/** 
* This is a generated class and is not intended for modification. To customize behavior 
* of this service wrapper you may modify the generated sub-class of this class - CASCOBackend.as. 
*/ 
package services.cascobackend 
{ 
import com.adobe.fiber.core.model_internal; 
import com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper; 
import com.adobe.serializers.utility.TypeUtility; 
import mx.rpc.AbstractOperation; 
import mx.rpc.AsyncToken; 
import mx.rpc.remoting.Operation; 
import mx.rpc.remoting.RemoteObject; 
import valueObjects.Ticket; 

import mx.collections.ItemResponder; 
import com.adobe.fiber.valueobjects.AvailablePropertyIterator; 

[ExcludeClass] 
internal class _Super_CASCOBackend extends    com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper 
{ 

    // Constructor 
    public function _Super_CASCOBackend() 
    { 
    // initialize service control 
    _serviceControl = new mx.rpc.remoting.RemoteObject(); 

    // initialize RemoteClass alias for all entities returned by functions of this service 
    valueObjects.Ticket._initRemoteClassAlias(); 

    var operations:Object = new Object(); 
    var operation:mx.rpc.remoting.Operation; 

    operation = new mx.rpc.remoting.Operation(null, "throwExceptionOnError"); 
    operation.resultType = Object; 
    operations["throwExceptionOnError"] = operation; 
    operation = new mx.rpc.remoting.Operation(null, "getTicketsByUser"); 
    operation.resultElementType = valueObjects.Ticket; 
    operations["getTicketsByUser"] = operation; 

    _serviceControl.operations = operations; 
    _serviceControl.convertResultHandler = com.adobe.serializers.utility.TypeUtility.convertResultHandler; 
    _serviceControl.source = "CASCOBackend"; 
    _serviceControl.endpoint = "http://localhost/CMphp/public/gateway.php"; 


    preInitializeService(); 
    model_internal::initialize(); 
} 

//init initialization routine here, child class to override 
protected function preInitializeService():void 
{ 
    destination = "CASCOBackend"; 

} 


/** 
    * This method is a generated wrapper used to call the 'throwExceptionOnError' operation. It returns an mx.rpc.AsyncToken whose 
    * result property will be populated with the result of the operation when the server response is received. 
    * To use this result from MXML code, define a CallResponder component and assign its token property to this method's return value. 
    * You can then bind to CallResponder.lastResult or listen for the CallResponder.result or fault events. 
    * 
    * @see mx.rpc.AsyncToken 
    * @see mx.rpc.CallResponder 
    * 
    * @return an mx.rpc.AsyncToken whose result property will be populated with the result of the operation when the server response is received. 
    */ 
public function throwExceptionOnError(link:Object) : mx.rpc.AsyncToken 
{ 
    var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("throwExceptionOnError"); 
    var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(link) ; 
    return _internal_token; 
} 

/** 
    * This method is a generated wrapper used to call the 'getTicketsByUser' operation. It returns an mx.rpc.AsyncToken whose 
    * result property will be populated with the result of the operation when the server response is received. 
    * To use this result from MXML code, define a CallResponder component and assign its token property to this method's return value. 
    * You can then bind to CallResponder.lastResult or listen for the CallResponder.result or fault events. 
    * 
    * @see mx.rpc.AsyncToken 
    * @see mx.rpc.CallResponder 
    * 
    * @return an mx.rpc.AsyncToken whose result property will be populated with the result of the operation when the server response is received. 
    */ 
public function getTicketsByUser(userid:Object) : mx.rpc.AsyncToken 
{ 
    var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getTicketsByUser"); 
    var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(userid) ; 
    return _internal_token; 
    } 

} 

} 
+0

是誰製作這段代碼?它非常*雜亂.... –

回答

1

夠簡單,_initRemoteClassAlias()不是門票的一部分,或者說,它是而不是static public

我不知道是誰做的代碼,但它沒有遵循我可以看到的任何標準。

+0

FlashBuilder創建了_Super類代碼 - 其餘示例僅顯示Ticket對象如何開始,PHP部分顯示如何構建數組等。 –

+0

你確定?我從來沒有見過這種從Flash Builder生成的代碼。任何人,你所指的功能都是無用的,所以你可以將它評論出來。 –

+0

另外,什麼不是靜態的公共? _Super文件,Ticket.as ???對不起,如果這是一個愚蠢的問題... –

相關問題