forked from: アップロードした画像はBitmap化できない?

by zahir forked from アップロードした画像はBitmap化できない? (diff: 56)
 ローカルでは出来た
 謎です
♥0 | Line 52 | Modified 2009-08-30 23:50:24 | MIT License
play

ActionScript3 source code

/**
 * Copyright zahir ( http://wonderfl.net/user/zahir )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4FCQ
 */

// ローカルでは出来た
// 謎です

package
{
	import flash.display.Sprite;
	import flash.display.Loader;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
import flash.display.Graphics;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.text.TextField;

	public class LoaderTest extends Sprite{
		private var l:Loader;
		private var bmp:Bitmap;
		private var bd:BitmapData;
		
		public function LoaderTest(){
			var url:String = "http://wonderfl.net/static/tmp/related_images/df7c3ce4f06fee871aa41f99d09aa8e4f2337c79m";
			l = new Loader();
			l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComp);
			l.load( new URLRequest( url ) );
var g:Graphics = this.graphics;
g.beginFill(0xFF0000);
g.drawRect(0,0, 20,20);
g.endFill();

		}
		private function onComp( e:Event ):void{
                        // 通常静止画を読んだ場合はBitmapになってるはず
var g:Graphics = this.graphics;
g.beginFill(0xFF00);
g.drawRect(20,0, 20,20);
g.endFill();
			if(l.content is Bitmap){
g.beginFill(0xFF);
g.drawRect(40,0, 20,20);
g.endFill();
				text();
				
				var b:Bitmap = l.content as Bitmap;
				addChild(b);
				clone( b );
			}
		}
		private function clone( data:Bitmap ):void{
			bmp = new Bitmap( data.bitmapData.clone() );
			bmp.x = data.width + 20;
			addChild( bmp );
		}
		private function text():void{
			var t:TextField = new TextField();
			t.text = "Bitmapだったよ!"
			addChild(t);
			t.y = l.height + 30;
		}
	}
}

Forked