Пробывал и так, и эдак, ничего не выходит
В чём ошибка?
Код: Выделить всё
package {
import flash.display.Sprite;
import flash.events.*;
import flash.display.*;
import main.VKButton;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.text.*;
public class Main extends Sprite {
private var api_id:Number=1823498;
private var api_secret:String="zaDONpPgFz";
private var externalXML:XML;
private var loader:URLLoader = new URLLoader();
private var photoLoader:Loader = new Loader();
private var viewer_id:Number;
private var sig:String;
private var uid:String;
private var bdate_txt:TextField = new TextField();
private var name_txt:TextField = new TextField();
public var wrapper: Object;
public function Main() {
viewer_id = wrapper.application.parameters.viewer_id;
getProfile(uid);
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
public function onAddedToStage(e: Event): void {
wrapper = Object(this.parent.parent);
wrapper.external.showInstallBox();
var btn2: VKButton = new VKButton('Настройки');
btn2.x = 10;
btn2.y = 415;
addChild(btn2);
var btn3: VKButton = new VKButton('Пригласить друзей');
btn3.x = btn2.x + btn2.width + 12;
btn3.y = btn2.y;
addChild(btn3);
var btn4: VKButton = new VKButton('Пополнить баланс');
btn4.x = btn3.x + btn3.width + 12;
btn4.y = btn3.y;
addChild(btn4);
var btn5: VKButton = new VKButton('?');
btn5.x = btn4.x + btn4.width + 12;
btn5.y = btn4.y;
addChild(btn5);
var btn6: VKButton = new VKButton('Закрыть');
btn6.x = -100;
btn6.y = -100;
addChild(btn6);
var btn: VKButton = new VKButton('Установить приложение');
btn.x = -100;
btn.y = -100;
addChild(btn);
btn2.addEventListener(MouseEvent.CLICK, function(e: MouseEvent):void {
wrapper.external.showSettingsBox();
});
btn3.addEventListener(MouseEvent.CLICK, function(e: MouseEvent):void {
wrapper.external.showInviteBox();
});
btn4.addEventListener(MouseEvent.CLICK, function(e: MouseEvent):void {
wrapper.external.showPaymentBox();
});
btn5.addEventListener(MouseEvent.CLICK, function(e: MouseEvent):void {
about.x=30;
about.y=25;
btn6.x=560;
btn6.y=340;
});
btn6.addEventListener(MouseEvent.CLICK, function(e: MouseEvent):void {
about.x=-1000;
about.y=-1000;
btn6.x=-100;
btn6.x=-100;
});
if (wrapper.application.parameters.is_app_user == 1) {
}else{
alert.x=0;
alert.y=0;
btn.x = 280;
btn.y = 215;
btn6.visible=false;
btn5.visible=false;
btn4.visible=false;
btn3.visible=false;
btn2.visible=false;
btn.addEventListener(MouseEvent.CLICK, function(e: MouseEvent):void {
wrapper.external.showInstallBox();
});
}
}
private function getProfile(uid):void {
sig=MD5.encrypt(viewer_id+'api_id='+api_id+'fields=bdate,photo_bigmethod=getProfilesuids='+uid+'v=2.0'+api_secret);
var request:URLRequest=new URLRequest("http://api.vkontakte.ru/api.php?api_id="+api_id+"&method=getProfiles&uids="+uid+"&fields=bdate,photo_big&v=2.0&sig="+sig);
loader.load(request);
loader.addEventListener(Event.COMPLETE, onComplete);
}
private function onComplete(event:Event):void {
var uname = externalXML..first_name + ' ' + externalXML..last_name;
name_txt.text=uname;
name_txt.x=140;
name_txt.y=80;
addChild(name_txt);
}
}
}