forked from: WIN, IE, FlashPlayer 10,0,45,2 debug のバグ

by matsu forked from WIN, IE, FlashPlayer 10,0,45,2 debug のバグ (diff: 55)
♥0 | Line 50 | Modified 2010-11-26 19:13:15 | MIT License
play

ActionScript3 source code

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

<?xml version="1.0" encoding="utf-8"?>
<!-- forked from matsu's WIN, IE, FlashPlayer 10,0,45,2 debug のバグ -->
<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.Event;
            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);
                
                    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");
                    ExternalInterface.call("function(){ focus(); }");
                }
            }

        ]]>
    </mx:Script>
    <mx:Box direction="vertical">
        <mx:Label text="WIN, IE, FlashPlayer 10,0,45,2 のバグ?" fontSize="16"/>
        <mx:Text id="textText" text="1. 日本語入力してみてください。"/>
        <mx:TextInput id="testInput"/>
        <mx:Label text="2. 次にブラウズでローカルにある画像を画面にロードします。"/>
        <mx:Button id="browseButton"/>
        <mx:Image id="testImage"/>
    </mx:Box>
    
</mx:Application>