flash on 2013-6-10

by aasdb
♥0 | Line 25 | Modified 2013-06-10 15:19:49 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var text:TextField = new TextField();
            addChild(text);
            
            text.text = sp([{type:-1},{type:1},{type:1}]).toString();
        }
        
        private function sp(arr:Array):Array {
            var res:Array = [];
            var type:int = arr[0].type;
            var a:*;
            
            for(var i:int=0; i<arr.length; i++){
                a = arr[i];
                if(type != a.type){
                    res.push(null);
                }
                res.push(a.type);
                type = a.type;
            }
            
            return res;
        }
    }
}