私用fla2
/**
* Copyright keno42 ( http://wonderfl.net/user/keno42 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/lfq1
*/
// 20110803 複数ファイル対応
// 画面をクリックしてファイルを選択するとロードして画像としての幅と高さを表示します。
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.net.FileReference;
import flash.net.FileReferenceList;
import flash.display.Loader;
public class FlashTest extends Sprite {
private var frl:FileReferenceList = new FileReferenceList;
private var index:int = 0;
private var tf:TextField = new TextField();
public function FlashTest() {
// write as3 code here..
addChild(tf);
tf.autoSize = "left";
stage.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void{
frl.addEventListener(Event.SELECT, function(e:Event):void{
stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
});
frl.browse();
});
}
private function onEnterFrame(e:Event):void{
stage.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
if( index == frl.fileList.length ){
return;
} else {
var fr:FileReference = frl.fileList[index++] as FileReference;
fr.addEventListener(Event.COMPLETE, function(e:Event):void{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void{
tf.appendText(fr.name + ": " + loader.content.width + ", " + loader.content.height + "\n");
stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
});
loader.loadBytes(fr.data);
});
fr.load();
}
}
}
}