0

我已经在 iOS 上使用 Parse.com,它很棒,我也知道 3rd 方 actionscript/parse API,但它只适用于 AIR。

所以我的问题是,如何让解析 API 与 Flash 网页游戏一起使用?(即使用 Flash 播放器)。

我相信还有一个使用 Parse.com REST API 的 PHP Parse API,这是一个选择吗?还是 Flash 播放器的某些内容无法与解析 API 一起使用?

4

3 回答 3

1

Flash 没有什么不能与 parse rest api 一起使用。如果您可以从 php 调用 api,则可以从 as3、c++、.net 或 klingon 调用它。

于 2012-12-06T05:50:10.660 回答
0

除非您是 POST 并发送数据/变量,否则 Flash 播放器不能使用标头,如果您想在 Flash 播放器中使用解析,您需要一个自定义的 flash.net.URLLoader,这是我找到的一个,但由于某种原因它没有'不适用于新版本的 Flash Player,这里是链接http://www.abdulqabiz.com/blog/archives/2006/03/03/http-authentication-for-httpget-requests-using-actionscript-3/

于 2013-08-14T04:31:50.273 回答
0

我找到了一种对 Parse 服务器执行有效 REST 调用的方法

public function runParseCloudFunction(cloudFunctionName:String):void 
        {             
            if (parseRequestor != null){
                return;
            }           

            //Create the HTTP request object 
            var request:URLRequest = new URLRequest( "https://api.parse.com/1/functions/" + cloudFunctionName ); 
            request.method = URLRequestMethod.POST; 

            // Create Parse headers
            var headerAppID:URLRequestHeader = new URLRequestHeader("X-Parse-Application-Id", MY_PARSE_APP_ID);
            var headerRestKey:URLRequestHeader = new URLRequestHeader("X-Parse-REST-API-Key", MY_PARSE_REST_KEY);
            var headerContentType:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");
            request.requestHeaders.push(headerAppID);
            request.requestHeaders.push(headerRestKey);
            request.requestHeaders.push(headerContentType);

            //Add the URL variables, json encoded format (OPTIONAL)             
            request.data = '{"param1":"sample1","param2":"sample2","param3":"sample3"}';

            //Initiate the transaction 
            parseRequestor = new URLLoader(); 
            //requestor.dataFormat = URLLoaderDataFormat.TEXT;          
            parseRequestor.addEventListener( Event.COMPLETE, callParseCloudFunctionCompleted ); 
            parseRequestor.addEventListener( IOErrorEvent.IO_ERROR, callParseCloudFunctionError ); 
            parseRequestor.addEventListener( SecurityErrorEvent.SECURITY_ERROR, callParseCloudFunctionError ); 
            parseRequestor.addEventListener( HTTPStatusEvent.HTTP_STATUS, callParseStatusHandler);
            parseRequestor.load( request ); 
        }

使用 cloud parse api 版本1.3.2测试

希望能帮助到你!!

于 2015-04-15T12:50:59.637 回答