0 Replies - 2810 Views - Last Post: 08 August 2012 - 09:54 AM

#1 trecords  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-August 12

[problem] My code not posts data to url

Posted 08 August 2012 - 09:54 AM

Hello,

I have a little problem in my code. Please check this code and let me know wht is problem. It is not posts data to remote server. The problem is in first two functions and second function is called by third one as your see.

function data_sent () {
	trace("Data Sent");
}

function post_results(userid,session,score) {
    var postData:URLVariables = new URLVariables();
    postData.uid = '00031653156431'; //User ID;
    postData.ses = 'gtrgrwe6gt46e54hy6e5hy'; //Session;
    postData.scr = '5487'; // Score
    
    // Post data to database
    var loader:URLLoader = new URLLoader();
    var req:URLRequest = new URLRequest("http://example.com/post.php");
    req.method = URLRequestMethod.POST;
    req.data = postData;
    
    try
    {
		loader.addEventListener(BulkLoader.COMPLETE,this.data_sent());
		loader.load(req);
		loader.start();
    }
    catch (error:Error)
    {
        trace("Unable to load requested document.");
    }
}


function endGame() {
	//
	trace("END GAME");
	this.post_results('0000534256562','a6erf4a6erf4','6589');
	//
	// create game over panel 
	setInterval(showMessage,3000);
	
	this.attachMovie("gameover","gameover",11);
	targ = this.gameover;
	//
	// position panel
	targ._x = _root.gameWid/2;
	targ._y = _root.gameHei/2-5;
	targ._xscale = 1;
	targ._yscale = targ._xscale;
	targ.bounceMe(100,.4,.4);
	//
	// store high scores, reset bonus vars
	_root.flushAndSend();
	_root.pauseGame = true;
	_root.timeBonus = 0;
}




Is This A Good Question/Topic? 0
  • +

Page 1 of 1