forked from: WIN, IE, FlashPlayer 10,0,45,2 のバグ?
forked from WIN, IE, FlashPlayer 10,0,45,2 debug のバグ (diff: 8)
ActionScript3 source code
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/rSgR
*/
<?xml version="1.0" encoding="utf-8"?>
<!-- forked from matsu's WIN, IE, FlashPlayer 10,0,45,2 のバグ? -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="app();">
<mx:Script>
<![CDATA[
import flash.display.Loader;
import flash.display.Bitmap;
import flash.events.*;
import flash.system.*;
import flash.events.MouseEvent;
import flash.net.FileReference;
private function app():void
{
var _fr:FileReference = new FileReference();
browseButton.addEventListener(MouseEvent.CLICK,onClick);
_fr.addEventListener(Event.SELECT,onSelect);
_fr.addEventListener(Event.COMPLETE,onComplete);
function onClick(e:Event):void{
_fr.browse();
}
function onSelect(e:Event):void{
var f:FileReference = FileReference(e.target);
f.load();
}
function onComplete(e:Event):void{
var f:FileReference = FileReference(e.target);
var loader:Loader = new Loader();
loader.loadBytes(f.data);
//It’s too early!!
//addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.INIT,init);
}
//Add the image at the stage center
function init(e:Event):void{
trace(e.target.content);//[object Bitmap]
var bmp:Bitmap = Bitmap(e.target.content);
testImage.addChild(bmp);
textText.text = "3. もう一度、日本語入力してみてください。\nなぜか日本語入力ができない。"
textText.setStyle("color", "#ff0000");
textText.setStyle("fontSize", "20");
}
}
private function onFocus(e:Event):void {
testInput.dispatchEvent(new FocusEvent(FocusEvent.FOCUS_OUT));
}
]]>
</mx:Script>
<mx:Box direction="vertical">
<mx:Label text="WIN, IE, FlashPlayer 10,0,45,2 のバグ?"/>
<mx:Text id="textText" text="1. 日本語入力してみてください。"/>
<mx:TextInput id="testInput" focusIn="onFocus(event)"/>
<mx:Label text="2. 次にブラウズでローカルにある画像を画面にロードします。"/>
<mx:Button id="browseButton"/>
<mx:Image id="testImage"/>
</mx:Box>
</mx:Application>