値の交換処理

by toilet7
http://www40.atwiki.jp/spellbound/pages/157.html
♥0 | Line 23 | Modified 2011-09-13 13:22:48 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.display.Sprite;
    
    public class FlashTest extends Sprite {
        
        public function FlashTest() {
            // write as3 code here..
        
            var a:int = 5;            
            var b:int = 7;
            
            var temp:int = a;
            a = b;
            b = temp;
            
            showResult("a = " + a, " / b = " + b, " / temp = " + temp); 
        }
        
         private function showResult(...result:*):void
        {
             var tf:TextField = new TextField();
             tf.defaultTextFormat = new TextFormat("arial", 19);
             tf.text = result.toString();
             tf.autoSize = "left";
             addChild(tf);
        }

    }
}