3 Replies Latest reply on Mar 17, 2011 11:06 AM by Flex harUI

    Problems setting focus to a TLF Textflow input field

    narcher68

      I'm using Flex builder 3.5 and have added TLF textflows to our application to support inline graphics. I've added a textflow as a child to an MX:canvas for the input field but I can't get it to have focus until it is clicked on. The setfocus call works when the textflow had focus and I return focus to it after other control windows have been used to adjust the font style but not when the application starts. Below is the creation complete from the MXML component containing the canvas.

       

      protected function creationComplete():void
      {
      // Attach input text flow to canvas
        var sprite:Sprite = new Sprite();
        tiCanvas.rawChildren.addChild(sprite);
       
        textFlow.flowComposer = new StandardFlowComposer();
        textFlow.flowComposer.addController(new ContainerController(sprite, tiCanvas.width, tiCanvas.height));
        textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,  onInlineGraphicChanged);
        textFlow.addEventListener(FocusEvent.FOCUS_IN, onTextFlowFocusIn);

        // Create edit manager and connect to flow
        editMan = new EditManager();
        textFlow.interactionManager = editMan;
       
        // Set inital text properties
        textFlow.fontSize = 14;
        textFlow.fontFamily = "Arial";

        textFlow.flowComposer.updateAllControllers();

        // Activate input flow  
        editMan.setFocus();
      }

       

      Any ideas why this doesn't work?

       

      Thanks,

      Nigel