flash on 2010-11-16

by TmskSt
左辺に三項演算子は使えない?
♥0 | Line 15 | Modified 2010-11-16 23:46:57 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextField;
    import flash.display.Sprite;
    
    /* 左辺に三項演算子は使えない? */
    public class FlashTest extends Sprite {
        
        private var field:TextField = addChild(new TextField()) as TextField
        
        public function FlashTest() {
            // write as3 code here..
            
            var a:String = "a", b:String = "b";
            (true) ? a : b = "foobar";
            
            this.log(a), this.log(b);
            
        }
        
        private function log(str:*):void {
            field.appendText(str + "\n");
        }

    }
}