package
{
    import com.flashdynamix.motion.TweensyGroup;
    
    import flash.display.*;
    import flash.geom.Point;
    import flash.text.engine.*;
    
    import org.tinytlf.ITextEngine;
    import org.tinytlf.components.TextField;
    import org.tinytlf.examples.spline.*;
    import org.tinytlf.layout.*;
    import org.tinytlf.layout.factories.*;
    import org.tinytlf.util.fte.ContentElementUtil;
    import org.tinytlf.util.fte.TextLineUtil;
    
    [SWF("600", height="600")]
    public class Spline extends Sprite
    {
        [Embed("assets/fonts/Archer-Medium-Pro.otf", fontFamily="ArcherMedium")]
        private var archer:Class;
        [Embed("assets/fonts/Archer-Semibold-Pro.otf", fontWeight="bold", fontFamily="ArcherSemibold")]
        private var archerSemiBold:Class;
        
        [Embed("assets/henrywadsworth.xml", mimeType="application/octet-stream")]
        private const xmlSource:Class;
        
        public function Spline()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            
            var tf:TextField = new TextField();
            tf.width = 550;
            tf.height = 600;
            
            var engine:ITextEngine = tf.engine;
            var factory:ITextBlockFactory = tf.engine.layout.textBlockFactory;
            
            factory.mapElementFactory('spline', SplineElementFactory);
            engine.decor.mapDecoration('spline', SplineDecoration);
            tf.layoutConstraintFactory = new SplineConstraintFactory();
            
            tf.style = 
                "*{" +
                "    fontName:ArcherMedium;" +
                "    fontSize: 25;" +
                "    textAlign: justify;" +
                "    color:0x000000;" +
                "}" +
                "p{" +
                "    padding-top: 10;" +
                "}" +
                "ul{" +
                "    list-style-position: outside;" +
                "}";
            
            tf.text = new xmlSource().toString();
            
            addChild(tf);
        }
    }
}