forked from: flash on 2010-11-13
forked from flash on 2010-11-13 (diff: 17)
Copyright aruerula ( http://wonderfl.net/user/aruerula ) MIT License ( http://www.opensource.org/licenses/mit-license.php ) Downloaded from: http://wonderfl.net/c/8c61 読み込みが完了しないうちに、Loader.contentにアクセスしようとしても、 エラーが出るんじゃ? ロードした画像をBitmap,matrix処理 http://a0.twimg.com/profile_images/1166146032/_____.png http://blog.cellfusion.jp/archives/633/
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/A2FM
*/
// forked from aruerula's flash on 2010-11-13
/**
* Copyright aruerula ( http://wonderfl.net/user/aruerula )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8c61
*/
/*
読み込みが完了しないうちに、Loader.contentにアクセスしようとしても、
エラーが出るんじゃ?
*/
package {
import flash.geom.Point;
import flash.geom.Matrix;
// ロードした画像をBitmap,matrix処理
//http://a0.twimg.com/profile_images/1166146032/_____.png
//http://blog.cellfusion.jp/archives/633/
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.system.Security;
public class Main extends Sprite {
private var file:String="http://assets.wonderfl.net/images/related_images/3/37/37f5/37f5f9a17dfa799dadba38e45e568d4da9b4ee23";
//yomikomi
public function Main() {
init();
}
//start
private function init():void{
//
Security.allowDomain("assets.wonderfl.net");
Security.loadPolicyFile("http://assets.wonderfl.net/crossdomain.xml");
//
//mizutama
for( var i:int=0; i<10; i++){
for( var j:int=0; j<10; j++ ){
var canvas:Sprite = new Sprite();
canvas.graphics.beginFill(Math.random()*0xFF0000);
canvas.graphics.drawCircle(30*i,50*j,5);
canvas.graphics.endFill();
addChild(canvas);
}
}
//loader
var loader:Loader=new Loader();
var url:URLRequest=new URLRequest(file);
loader.load(url);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,complete);
}
//bitmap
private function complete(event:Event):void{
event.target.removeEventListener(Event.COMPLETE,complete);
event.target.loader.addEventListener(Event.ENTER_FRAME,next);
}
private function next(event:Event):void{
var content:Bitmap = event.target.content;
var bmd:BitmapData=new BitmapData(content.width, content.height);
var matrix:Matrix = new Matrix();
//matrix.rotate( 45 * Math.PI / 180 ); // kaiten
matrix.translate(0,0); // pointchange
matrix.rotate( 5 * Math.PI / 180 );
matrix.translate(0,0);
matrix.scale(0.5,0.5); //size
matrix.concat(transform.matrix);
transform.matrix = matrix;
//bmd.draw(content,matrix);
//var bm:Bitmap = new Bitmap(bmd);
//bm.x = 100
//bm.y = 100;
//addChild(bm);
}
}
}