Skip to main content
Known Participant
June 15, 2010
Answered

import markup incl. linkNormalFormat/...

  • June 15, 2010
  • 1 reply
  • 961 views

Hi there!

Importing a LinkElement via code is not a problem, but to set the linkNormalFormat/linkHoverFormat for it is an issue:

Via Code it works like this:

            ....

            var linkNormalFormat:TextLayoutFormat = new TextLayoutFormat();
            linkNormalFormat.color = 0xff0000;
           
            var span:SpanElement = new SpanElement();
            span.text = "This is a Test";
           
            var linkElement:LinkElement = new LinkElement();
            linkElement.linkNormalFormat = linkNormalFormat;
            linkElement.addChild(span);
           
            var paragraphElement:ParagraphElement = new ParagraphElement();
            paragraphElement.addChild(linkElement);  

            textFlow.addChild(paragraphElement);

            ....

I tried to do implement the same structure in XML:

  var xml:XML =
            <TextFlow xmlns='http://ns.adobe.com/textLayout/2008'>

                <p>                 

                    <a>

                         <linkNormalFormat><color>#ff0000</color><linkNormalFormat> <!-- I tried loads of possibilities, thats only one try ... -->
                        <span>TLF LINK</span>
                    </a>
                </p>
            </TextFlow>;

after importing that XML to the TextFlow I get the follow Error:

Error: Expected one and only one TextLayoutFormat in http://ns.adobe.com/textLayout/2008::linkNormalFormat
    at BaseTextLayoutImporter/reportError()
    at flashx.textLayout.conversion::TextLayoutImporter/createDictionaryFromXML()
    at flashx.textLayout.conversion::TextLayoutImporter$/parseLinkNormalFormat()

    ....

Has anyone an idea why that happens, or has anyone already imported formatted links inside XML with TLF?

THANKS!!!

This topic has been closed for replies.
Correct answer rdermer

This works:

<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'>
                <p>                
                    <a>
                         <linkNormalFormat><TextLayoutFormat color="0xff0000"/></linkNormalFormat>
                        <span>TLF LINK</span>
                    </a>
                </p>
            </TextFlow>

Richard

1 reply

rdermerCorrect answer
Adobe Employee
June 15, 2010

This works:

<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'>
                <p>                
                    <a>
                         <linkNormalFormat><TextLayoutFormat color="0xff0000"/></linkNormalFormat>
                        <span>TLF LINK</span>
                    </a>
                </p>
            </TextFlow>

Richard