
Код AS3:
package
{
import flash.display.Sprite;
import flash.events.Event;
/*
import flash.display.Loader;
import flash.net.URLRequest;
import flash.text.TextField;
import vk.APIConnection;
import vk.api.serialization.json.JSON;
*/
/**
* ...
* @author Volodin Alexandr Sergeevich
*/
public class Main extends Sprite
{
public function Main()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
/*
public var flashVars:Object = stage.loaderInfo.parameters as Object;
public var VKAPI:APIConnection = new APIConnection(flashVars);
public static var avatar:String = new String;
private var txt:TextField;
*/
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
addChild(new Profile); // добавил класс в Main
/*
txt = new TextField();
txt.width = 800;
txt.height = 600;
txt.wordWrap = true;
txt.appendText("> flashVars: " + JSON.encode(flashVars) + "\n\n");
addChild(txt);
VKAPI.api(
"users.get", { user_ids:flashVars['viewer_id'], fields:"photo_50", name_case:"nom" }, usersGetSuccess, usersGetError
);
*/
}
/*
public function usersGetSuccess(data:Object):void
{
txt.appendText("> usersGet: " + JSON.encode(data) + "\n\n");
avatar = data[0].photo_50;
txt.appendText("> avatar: " + avatar + "\n\n");
var loader:Loader = new Loader();
loader.load(new URLRequest(avatar));
loader.x = 100;
loader.y = 100;
addChild(loader);
}
public function usersGetError(data:Object):void
{
txt.appendText("> usersGet: error: " + JSON.encode(data) + "\n\n");
}
*/
}
}

Код AS3:
package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.text.TextField;
import vk.APIConnection;
import vk.api.serialization.json.JSON;
/**
* ...
* @author Volodin Alexandr Sergeevich
*/
public class Profile extends Sprite
{
public var flashVars:Object;
public var VKAPI:APIConnection;
public static var avatar:String = new String;
private var txt:TextField;
public function Profile()
{
txt = new TextField();
txt.width = 800;
txt.height = 600;
txt.wordWrap = true;
addChild(txt);
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
private function addedToStage(e:Event):void
{
flashVars = stage.loaderInfo.parameters as Object;
VKAPI = new APIConnection(flashVars);
txt.appendText("> flashVars: " + JSON.encode(flashVars) + "\n\n");
VKAPI.api(
"users.get", { user_ids:flashVars['viewer_id'], fields:"photo_50", name_case:"nom" }, usersGetSuccess, usersGetError
);
}
public function usersGetSuccess(data:Object):void
{
txt.appendText("> usersGet: " + JSON.encode(data) + "\n\n");
avatar = data[0].photo_50;
txt.appendText("> avatar: " + avatar + "\n\n");
var loader:Loader = new Loader();
loader.load(new URLRequest(avatar));
loader.x = 100;
loader.y = 100;
addChild(loader);
}
public function usersGetError(data:Object):void
{
txt.appendText("> usersGet: error: " + JSON.encode(data) + "\n\n");
}
}
}
Добавлено через 1 минуту
Напишите к каким выводам пришли после прочтения моего кода.