首先,这是我得到的确切错误:
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();
}
错误发生的具体行是:
valueObjects.Ticket._initRemoteClassAlias();
在应用程序中,我(显然)创建了一个名为Ticket的值对象,其存在方式如下:
package valueObjects
{
[Bindable]
[RemoteClass(alias="Ticket")]
public class Ticket
{
public var ticketid:int;
public var ticketNumber:String;
etc...
etc...
它引用的PHP函数只是抓取具有特定参数的所有项目,并返回Ticket []数组,其结果为单个Ticket项,如下所示:
...
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
$row = new Ticket();
mysqli_bind_result($stmt, $row->ticketid, etc...
另外 - 当我在FlashBuilder中运行此函数的测试时,它会按照我的预期返回项目,即使显示有关_initRemoteClassAlias的错误。如果我只是注释掉那条线,那么代码在运行时就不会返回任何内容(虽然在FB中测试时它仍会返回值)
所以 - 我已经把它搞砸了这个小时并四处寻找答案,但我没有想法。希望你有一些!
提前感谢您的帮助! -CS
EDIT ::: EDIT :::
好的 - 这是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()
不是Ticket的一部分,或者它不是static public
。
我不知道是谁制作了代码,但它没有遵循我能看到的任何标准。