2011-08-04 195 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 ???对不起,如果这是一个愚蠢的问题... –

相关问题