Search code examples
phpactionscript-3httpunreal-development-kitscaleform

UDK Scaleform 4 AS3 cross-domain URLRequest possible?


I want to post and get Highscores for my UDKGame via HTTP Requests to my webserver with an online Mysql database, Scaleform 4 (AS3) and PHP. Unfortunately I think that may not be possible, considering this document: http://gameware.autodesk.com/documents/gfx_4.0_flash_support.pdf .

I tried sending an URLRequest from my GFx Movie Player, but it doesn't seem to work. Heres my AS3 Code I'm using for my GFx Movie Player in Frame 1:

getScore();

function getScore():void {
//var url:String = "http://myserver.com/getScore.php";
    var request:URLRequest = new URLRequest(url);
    var requestVars:URLVariables = new URLVariables();
    requestVars.foo = "bar";
    request.data = requestVars;
    //request.method = URLRequestMethod.POST;
    //Security.allowDomain("myserver.com"); 
    //var context:LoaderContext = new LoaderContext();
    //context.securityDomain = SecurityDomain.currentDomain

    var urlLoader:URLLoader = new URLLoader();
    urlLoader = new URLLoader();
    urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
    urlLoader.addEventListener(Event.COMPLETE, loaderCompleteHandler, false, 0, true);
    urlLoader.load(request);

    }

function loaderCompleteHandler(e:Event):void {
    trace(e.target.data);
    Object(this).response.text= "response:"+e.target.data;

}

Is There any way to achieve my goal without writing a .dll or use a manual TCP connection to my webserver?


Solution

  • Unfortunately, the Scaleform that comes with UDK (4.0.16) does not have any networking support built into it. You'll have to have UDK do that part of the problem via dll bind or something else. Scaleform 4.2 added networking support but that version of Scaleform is not quite yet integrated into UDK. It IS in the process of being integrated though, so hopefully we'll see it soon.