Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vorushin/501814 to your computer and use it in GitHub Desktop.
Save vorushin/501814 to your computer and use it in GitHub Desktop.
package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextField;
import com.adobe.serialization.json.JSON;
public class Main extends Sprite
{
private var textField2:TextField;
private var wallPostLoader:URLLoader;
public function Main()
{
addEventListener(Event.ADDED_TO_STAGE, onStage);
}
public function onStage(evt:Event):void
{
var wrapper:Object = Object(parent.parent);
var parameters:Object = wrapper.application.parameters;
wallPostLoader = new URLLoader();
wallPostLoader.load(new URLRequest('http://drawity.risovaska.ru/vk/wall_post/' + parameters.post_id + '/'));
wallPostLoader.addEventListener(Event.COMPLETE, function(evt:Event):void {
var json:Object = (JSON.decode(wallPostLoader.data) as Object);
var imageLoader:Loader = new Loader();
var image:URLRequest = new URLRequest(json.image_url);
imageLoader.load(image);
addChild(imageLoader);
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment