Тема: Vkontakte + Server
Показать сообщение отдельно
Старый 17.07.2011, 19:40
Max360 вне форума Посмотреть профиль Отправить личное сообщение для Max360 Найти все сообщения от Max360
  № 11  
Ответить с цитированием
Max360

Регистрация: Mar 2011
Сообщений: 168
Код AS3:
var host:String = 'http://domain.guru-hosting.ru/RSPBase'; 
 
var user_id = 5960119;
var auth = '84d1f7df20e7008b94f651abced6f5d2';
 
set_btn.addEventListener(MouseEvent.CLICK, onSet);
get_btn.addEventListener(MouseEvent.CLICK, onGet);
//------------------------------------------------------------------------------------------------
function onSet(e:MouseEvent){
	try{
		var loader:URLLoader = new URLLoader();
		var request:URLRequest = new URLRequest(host+'/set_score.php');
		var variables:URLVariables = new URLVariables();
		variables['user_id'] = user_id;
		variables['score_res'] = 1;
		variables['auth'] = auth;
		request.data = variables;
		loader.load(request);	
	}
	catch(e:Error){
		txt.text+=e.message+"   ";
	}
}
//------------------------------------------------------------------------------------------------
function onGet(e:MouseEvent){
	var loader:URLLoader = new URLLoader();
	loader.load(new URLRequest(host+'/get_score.php?user_id='+user_id+'&auth='+auth));
	loader.addEventListener(Event.COMPLETE, onLoad_Complete);
}
//------------------------------------------------------------------------------------------------
function onLoad_Complete(e:Event){
	var xml = new XML(e.target.data);
	wins.text = xml..wins;
	losses.text = xml..losses;	
}