Take notes
Try flash cs4. The player of cs3 won't work.
Import ~~~
Var file: FileReference = new FileReference ();
Var loader: Loader = new Loader ();
Liulan. addEventListener (MouseEvent. CLICK, onClick );
Function onClick (event: MouseEvent): void {
File. browse ([new FileFilter ("Images (*. jpg ;*. png ;*. gif )","*. jpg ;*. png ;*. gif ")]);
File. addEventListener (Event. SELECT, onSelect );
}
Function onSelect (event: Event): void {
File. load ();
File. addEventListener (Event. COMPLETE, onComplete );
FileName. text = file. name;
}
Function onComplete (event: Event): void {
Loader. loadBytes (file. data );
Loader. contentLoaderInfo. addEventListener (Event. COMPLETE, onComplete2 );
}
Var bitmap: Bitmap;
Function onComplete2 (event: Event): void {
/* 1. if (bitmap! = Null)
{
RemoveChild (bitmap );
}
Loader. width = stage. stageWidth;
Loader. height = stage. stageHeight;
Var container: Sprite = new Sprite ();
Container. addChild (loader );
Var BMP data: BitmapData = new BitmapData (container. width, container. height );
BMP data. draw (container );
Bitmap = new Bitmap (BMP data );
AddChildAt (bitmap, 0 )*/
If (bitmap! = Null)
{
RemoveChild (bitmap );
}
Bitmap = event.tar get. content as Bitmap;
Bitmap. width = stage. stageWidth;
Bitmap. height = stage. stageHeight;
AddChildAt (bitmap, 0 );
}