Skip to main content
Participant
February 17, 2010
Question

textAlign justify and linkElement problem

  • February 17, 2010
  • 2 replies
  • 1839 views

Hi,

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 !

Olivier

PS : I used the build 13875.

This topic has been closed for replies.

2 replies

Participant
March 22, 2011

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.

Adobe Employee
February 17, 2010

Hi,

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?

Thanks,

Richard

ojuinAuthor
Participant
February 18, 2010

Hi,


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()">
   
    <mx:Script>
        <![CDATA[
            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;
                textArea.addChild(container);
               
                textFlow = new TextFlow();
                var controller:ContainerController = new ContainerController(container);//, width, height);
                textFlow.flowComposer.addController(controller);
               
                var p:ParagraphElement = new ParagraphElement();
               
                p.textAlign = TextAlign.JUSTIFY;
                               
                textFlow.paragraphStartIndent = 50;
                textFlow.paragraphEndIndent = 50;
               
                textFlow.addChild(p);
               
                var span1:SpanElement = new SpanElement();
                span1.text = "Legal values are numbers from 1 to 720 Legal values are numbers from 1 to 720 ";
                p.addChild(span1);
               
                var link:LinkElement = new LinkElement();
                var linkSpan:SpanElement = new SpanElement();
                linkSpan.text = "a link";
                link.addChild(linkSpan);
                p.addChild(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 ....";
                p.addChild(span2);
               
                textFlow.flowComposer.getControllerAt(0).setCompositionSize(300,10000);
                textFlow.flowComposer.updateAllControllers();
               
            }
        ]]>
    </mx:Script>
   
    <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"/>
   
</mx:Application>

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.

Olivier

ojuinAuthor
Participant
February 19, 2010

Hi,

The behaviour is very mysterious :

on my pc, if I put :

textFlow.flowComposer.getControllerAt(0).setCompositionSize(200,7999);

==> everything works in justify mode

textFlow.flowComposer.getControllerAt(0).setCompositionSize(200,8000);

==> 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 ?

Thanks,

Olivier