3 Replies Latest reply: May 17, 2013 11:16 AM by Flex harUI RSS

    flowComposer is null

    miguel.cd.ferreira

      Normal behaviour:

      If i change the text, size or resize the component i have always the standard flow composer and that is great!

       

      Because i need it to read the lines and the content for each line.

      FDCustomRichEditableText.textFlow_damageHandler(event)[object StandardFlowComposer]

      BUT!

      After i change the font family ( i am using embebed fonts with cff) the text flow change my flow composer to:

      FDCustomRichEditableText.textFlow_damageHandler(event)[object TCMFactoryDisplayComposer]

      Then every time that the text is damaged my flow composer is null.

       

      Would be great if someone could help me to prevent this behaviour!!!

      Flex sdk 4.6

        • 1. Re: flowComposer is null
          Flex harUI Adobe Employee

          How small a test case can you put together?

          • 2. Re: flowComposer is null
            miguel.cd.ferreira Community Member

            When the user makes a operation, (eg.: Change size of the component, change size of the font, write, change font) i have a damage handler to make some fix on the text and for that i need to acces line by line, this line are on the flow composer.

             

            The normal beahaviour is when i change the size of the font, write something or change the size of the component i can have access to the standadFlowComposer and everything works as expected.

             

             

            protected function textFlow_damageHandler(event:DamageEvent):void

            {

                 if (textFlow.flowComposer==null)

                        //setFlowComposer();

                   else

                        setCorrectText();

            }

             

            But when i select a font sometimes my flow composer goes null so as you can see on the code above i was trying to set a flowcomposer but and i try to access the lines they are always null.

             

            ...

            for (var i:int=0; i<len; i++)

              {

                                tfl = this.textFlow.flowComposer.getLineAt(i);

             

                                 if (tfl==null)

                                 {

                                         trace("LINE IS NULL");

                                         return;

                                  }

            ...

             

            By the traces i found out that the standarflwocomposer is changed for a TCMFactoryDisplayComposer

            and after that i get null every where and lot of errors on the component.

             

             

            .....

             

            So here comes a litle description of the code, as i said i use embebed fonts, and this is the event handler when the font is loaded from the server and registed on flex i setted the font family to the component.

             

            protected function fontLoaded_completeHandler( event : FDFontEvent ) : void

                                {

                                          if (event==null ||

                                                    event.data==null ||

                                                    !event.data is FDFontData ||

                                                    (event.data as FDFontData).fontName != fontFamily ||

                                                    richEditableText.getStyle("fontFamily")==(event.data as FDFontData).className

                                          )

                                                    return;

             

                                          fontLoaded = true;

             

                                          fontManager.removeEventListener(FDFontEvent.FONT_LOADED_COMPLETE, fontLoaded_CompleteHandler);

                                          richEditableText.setStyle( "fontFamily", (event.data as FDFontData).className );

                                }

             

             

            Thank you for the reply, i hope that someone have a idea!

            Kudos points for him!!!!

            • 3. Re: flowComposer is null
              Flex harUI Adobe Employee

              What kind of SWF is the font embedded in?  A Flex Module?  Something else?  It may not work if you just load embedded fonts that were embedded in some SWF you created in FlashPro.  Also, the complete Event may fire before the font gets registered so it may be that the code can't find the font.