flash on 2010-9-10

by grapefrukt
♥0 | Line 24 | Modified 2011-01-03 18:36:52 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import Namespace;
   
    public class FlashTest extends Sprite {
    
        private var tf:TextField;
    
        public function FlashTest() {
            tf = new TextField();
            tf.height = 300;
            tf.width = 500;
            addChild(tf);           
           
           var myPattern:RegExp = /\[video\]([a-zA-Z0-9_-]+)\[\/video\]/g;  
           var str:String = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. \n[video]AAAAAAAAAAA[/video]\nDonec commodo condimentum enim, vitae consectetur felis pharetra a.";
           var result:Object = myPattern.exec(str);
           while (result != null) {
               trace( "id is: " + result[0] + " at index: " + result.index);
               result = myPattern.exec(str);
           }
           
        }
        
        public function trace(t:*):void{
            tf.appendText(t + "\n");
        }
    }
}