5 Replies Latest reply on Mar 22, 2011 5:28 AM by ugai

    textAlign justify and linkElement problem




      I have a paragraph with text and a link.

      The link contains a span (backgroundColor = blue, fontWeight=bold) and all properties of each link format (format, linkNormalFormat, linkActiveFormat, linkHoverFormat) inherit from the paragraph format.


      I added event listener on the link to manage tooltip.


      It works perfectly if paragraph.textAlign = "left" or "right" as shown in attached pictures.


      But if I change my code to paragrah.textAlign="justify" (without changing anything else), I obtain a bad result (as shown in attached picture) :

      - the backgroundColor on the span doesn't work anymore (but the bold is still working)

      - my tooltip event listener doesn't work anymore.


      I don't understand why, thanks for your help !




      PS : I used the build 13875.

        • 1. Re: textAlign justify and linkElement problem
          rdermer Adobe Employee



          I can't quite duplicate the bug.  Can you send your markup or even better a small actionscript example demonstrating the problem that can be built?  Also does removing the event listener make a difference?  Finally have you tried it with the 10.1 player?




          • 2. Re: textAlign justify and linkElement problem
            ojuin Level 1


            Here is the code :


            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
                        import flashx.textLayout.events.FlowElementMouseEvent;
                        import flashx.textLayout.elements.LinkElement;
                        import flashx.textLayout.formats.TextAlign;
                        import flashx.textLayout.elements.SpanElement;
                        import flashx.textLayout.elements.ParagraphElement;
                        import flashx.textLayout.container.ContainerController;
                        import flashx.textLayout.elements.TextFlow;
                        import mx.core.UIComponent;
                        private var textFlow:TextFlow;
                        private function init():void
                            var container:UIComponent = new UIComponent();
                            container.width = textArea.width - 5;
                            container.height = textArea.height - 5;
                            textFlow = new TextFlow();
                            var controller:ContainerController = new ContainerController(container);//, width, height);
                            var p:ParagraphElement = new ParagraphElement();
                            p.textAlign = TextAlign.JUSTIFY;
                            textFlow.paragraphStartIndent = 50;
                            textFlow.paragraphEndIndent = 50;
                            var span1:SpanElement = new SpanElement();
                            span1.text = "Legal values are numbers from 1 to 720 Legal values are numbers from 1 to 720 ";
                            var link:LinkElement = new LinkElement();
                            var linkSpan:SpanElement = new SpanElement();
                            linkSpan.text = "a link";
                            link.addEventListener(FlowElementMouseEvent.ROLL_OVER, function (e:Event):void
                                onoverbtn.visible = true;
                            link.addEventListener(FlowElementMouseEvent.ROLL_OUT, function (e:Event):void
                                onoverbtn.visible = false;
                            var span2:SpanElement = new SpanElement();
                            span2.text = " Legal values are numbers from 1 to 720 Legal values are numbers from 1 to 720 ....";
                <mx:Button id="onoverbtn" label="on over !!!!" visible="false" fontSize="50"/>
                <mx:Canvas id="textArea" backgroundColor="#ffffff" verticalCenter="0" horizontalCenter="0" height="500" width="500"/>


            Comment and uncomment row 31 (p.textAlign = TextAlign.JUSTIFY;), if commented, everything is ok, else, the link doesn't work anymore


            I have flashplayer 10,0,32,18 installed.


            Thanks a lot.



            • 3. Re: textAlign justify and linkElement problem
              ojuin Level 1



              The behaviour is very mysterious :


              on my pc, if I put :


              ==> everything works in justify mode


              ==> it doesn't work in justify mode !!!


              On an other pc, the limit is different :

              8048 => it works

              8049 => it does'nt work


              Any limitation known about the composition height ?





              • 4. Re: textAlign justify and linkElement problem
                rdermer Adobe Employee


                I can duplicate the bug with the 10.0 player - it doesn't reproduce with the 10.1 player.  Looks like its one of the player bugs that was fixed in 10.1.


                You can download player 10.1 beta 2 here:



                I'm using a more recent 101 player than beta 2 so I can't guarantee the fix is in beta2.


                I don't have a 10.0 workaround.


                It seems to work in this case but why are you using UIComponent?  Why not use a Sprite and add it to the textArea's rawChildren?  Is there an advantage to UIComponent?  A sprite is fully interactive in this case.  Switching to Sprite doesn't solve the bug but I was just curious.




                • 5. Re: textAlign justify and linkElement problem

                  It is displayed as a letter without being linked in Flex SDK development here when I meet the following conditions.


                  flex_sdk_4.5.0.18623 -- It is not linked.

                  flex_sdk_4.1.0.16076 -- I work definitely.