0 Replies Latest reply on Oct 27, 2009 6:42 AM by osurikiran

    Text Layout Framework text rendering in dynamically created linked pages

    osurikiran Level 1

      Hii

      I am using TLF , to render the text  need to display text in pages like MS Word application.

      Currently i am creating sprite and adding the sprite to the ContainerControl and . My problem is the new sprite need to be created if the text reaches the end of sprite. and  text flow  continued in new sprite. all shoud be happen in programmaticlly.

      how can i achieve it. is there any event that triggers the container fill or end of sprite or page fill.

       

       

       

      my code is

       

       

      public function set textContainers(_uicomponentsArray:Array):void

      {

      this.uicomponentsArray = _uicomponentsArray;

      }

       

      public function set text(_xml:XML):void

      {

       

      this.xml = _xml;

      }

       

      public function set parentContainer(_vgroup:VGroup):void

      {

      this.vgroup = _vgroup;

      }

       

      protected function setContainer(tempuicompArray:Array):void

      {

      for(var i:int = 0; i<tempuicompArray.length; i++)

      {

       

      _textflow.flowComposer.addController(new ContainerController(tempuicompArray[i],tempuicompArray[i].width,tempuicompArray[i].height ));

      }

      _textflow.flowComposer.updateAllControllers();

      }

       

      protected function createNewPage():void

      {

       

      var uicomponent:UIComponent = new UIComponent();

      uicomponent.width = 800;

      uicomponent.height = 800;

       

      var canvas:Canvas = new Canvas();

      canvas.percentWidth = 100;

      canvas.height = 100;

       

      canvas.setStyle("borderStyle", "solid");

       

          canvas.addChild(uicomponent);

      uicomponentsArray.push(uicomponent);

      vgroup.addElement(canvas);

       

      setContainer(uicomponentsArray);

      }

       

      protected function resizeHandler():void

      {

      if(initialized)

      {

      for(var i:int = 0; i < _textflow.flowComposer.numControllers; i++)

      {

      ContainerController(_textflow.flowComposer.getControllerAt(i)).setCompositionSize(uicompon entsArray[i].width,uicomponentsArray[i].height);

      }

      _textflow.flowComposer.updateAllControllers();

      }

      }

      /****       Applicaiton completion Handler      *****************/

      protected function oninit():void

      {

      uicomponentsArray = new Array();

       

      _textflow = null;

      _textflow = TextFilter.importToFlow( xml, TextFilter.TEXT_LAYOUT_FORMAT);

      _textflow.interactionManager = new EditManager(new UndoManager());

       

       

      _textflow.addEventListener(SelectionEvent.SELECTION_CHANGE,selectionChangeHandler,false,0, true);

      _textflow.addEventListener(FlowOperationEvent.FLOW_OPERATION_BEGIN, test);

       

      createNewPage();

       

      }

       

       

       

       

      In above code i wanna call createNewPage() function in response to text reaches the end of  sprite or  UIComponent

       

       

      help me out pls

       

      thans & Regards

      kiran