【问题标题】:How to get parse.com working with the Flash Player?如何让 parse.com 与 Flash Player 一起工作?
【发布时间】:2012-11-24 01:16:53
【问题描述】:

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

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

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

【问题讨论】:

    标签: actionscript-3 flash parse-platform


    【解决方案1】:

    我找到了一种对 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 ); 
            }
    

    用云解析api版本1.3.2

    测试

    希望对你有帮助!!

    【讨论】:

      【解决方案2】:

      除非你是 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/

      【讨论】:

        【解决方案3】:

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

        【讨论】:

        • 这是第 3 方 API github.com/parkerkrhoyt/Parse 的链接,如果您向下滚动,您应该会看到它显示“注意 Flash Player 不允许修改 HTTP 身份验证标头,因此此库仅适用于使用 AIR。我在桌面和移动应用程序上都对其进行了测试。"
        • 好吧,那么你是说只使用 Flash 播放器中的 PHP API?
        • 您可以使用 flash 进行身份验证标头,但不能使用标准组件。菲尔,如果你需要这样的课程,我会给你发一封我写的邮件。是否自定义标题,完整的宁静放置,删除等,
        • 谢谢,不过还是很困惑 :),所以您的课程可以直接从 Flash 播放器到 Parse.com REST API?还是通过 PHP 进行?
        • 这里是一个开源类库的链接,它的功能类似于我正在做的事情RestHTTPService 它说它替换了 Flex HTTPService 组件,但我查看了它的代码,它是用纯 as3 并且不依赖于我可以看到的 flex。
        猜你喜欢
        • 1970-01-01
        • 2023-02-02
        • 1970-01-01
        • 1970-01-01
        • 2017-06-25
        • 2020-12-13
        • 2012-02-02
        • 2011-02-22
        • 2013-03-24
        相关资源
        最近更新 更多