Loader Test (1)
Related images
ActionScript3 source code
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/kMLm
*/
////////////////////////////////////////////////////////////////////////////////
// Loader Test (1)
////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.system.LoaderContext;
import flash.geom.Rectangle;
import flash.geom.Matrix;
import flash.display.GradientType;
import flash.display.SpreadMethod;
import flash.display.InterpolationMethod;
import net.hires.debug.Stats;
[SWF(backgroundColor="#000000", width="465", height="465", frameRate="30")]
public class Main extends Sprite {
private var loader:Loader;
private static var basePath:String = "http://assets.wonderfl.net/images/related_images/";
private static var filePath:String = "2/21/2175/2175d71879d236c4f82106a7301413d97b877693";
public function Main() {
//Wonderfl.capture_delay(4);
init();
addChild(new Stats());
}
private function init():void {
draw();
//
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded, false, 0, true);
loader.load(new URLRequest(basePath + filePath), new LoaderContext(true));
}
private function loaded(evt:Event):void {
var content:Bitmap = Bitmap(loader.content);
addChild(content);
content.x = 32;
content.y = 32;
}
private function draw():void {
var colors:Array = [0x00AAE4, 0x0069A0];
var alphas:Array = [1, 1];
var ratios:Array = [0, 255];
var matrix:Matrix = new Matrix();
matrix.createGradientBox(465*2, 465*2, 0, -465/2, -465/2);
graphics.beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matrix, SpreadMethod.PAD, InterpolationMethod.RGB, 0);
graphics.drawRect(0, 0, 465, 465);
graphics.endFill();
}
}
}