reverse()を知る。

by demouth
♥0 | Line 39 | Modified 2010-02-05 14:11:15 | MIT License
play

ActionScript3 source code

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

package {
	import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
    	
    	public var text:TextField = new TextField();
    		
        public function FlashTest() {
            // write as3 code here..
            
            this.addChild(this.text);
			
			this.testVctor();
			
			this.trace("\n");
			
			this.testArray();
			
        }
		
		public function testVctor():void
		{
			var i:int;
            var vec:Vector.<int> = new Vector.<int>();
            vec.push(0);
            vec.push(1);
            vec.push(2);
            for (i = 0; i < vec.length; i++) this.trace(String(vec[i]));
			vec.reverse();
            for (i = 0; i < vec.length; i++) this.trace(String(vec[i]));
		}
		
		public function testArray():void
		{
			var i:int;
            var array:Array = [];
            array.push(0);
            array.push(1);
            array.push(2);
            for (i = 0; i < array.length; i++) this.trace(String(array[i]));
			array.reverse();
            for (i = 0; i < array.length; i++) this.trace(String(array[i]));
		}
		
		public function trace(str:String):void
		{
            this.text.appendText(str);
		}
		
        
    }
}