Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

XML, CSS, Tabs and unwanted line breaks

New Here ,
May 04, 2011 May 04, 2011

Hi,

I've spent days trying to sort this one out...including many hours trawling the web but to no avail so hopefully some one here can help out.

I have a site that compiles to Actionscript 2.0 and Flash player 8.  This site utilises XML output from ASP.Net driven database pages.

The problem I have is basically that where I have some tabstops set,  in certain cases,  where the text starting from the first tab stop is over a certain length an unwanted line break is output just before the last word in the entry.  (I know it's always the last word since if I put another word on the end of the string the word that was originally on the new line is back in it's proper place - so it doesn't appear to be length related).

Effectively,  what I want is as follows:

header1:      Descriptive text header 1                                     header2: Description header 2

header3:      Description header 3                                          header4: header 4 text

descriptive text here across multiple lines

           

What I'm getting is something like this:

header1:      Descriptive text header 1                                     header2: Description header 2

header3:      Description header 3 with a long

description   header4: header 4 text

descriptive text here across multiple lines

The Xml I am loading is as follows (This has been anonymised and the angle brackets changed to '[]')

[?xml version="1.0" encoding="utf-8"?]
[config scrollPosition="right" styleSheet=".\stylesheets\cv.css"]
     [text]
          [textformat tabstops = "50,540,590"]:[tab /]T[tab /]T[tab /]T[tab /]:[br /]
               [list_by]CV Entries By Date[/list_by]
               [br /]
               [headertext]Date:[/headertext]
               [tab /]
               [itemheader]Sep 2010 - Mar 2011[/itemheader]
               [tab /]
               [headertext]Agency:[/headertext]
               [tab /]
               [itemheader][a href="http://www.xxxx.eu/xxxx.cfm" target="_blank"]xxxxx[/itemheader]
               [br /]
               [headertext]Role:[/headertext]
               [tab /]
               [itemheader]Abap Programmer Application Maintenance SAP ECC 6.0 Finland[/itemheader]
               [tab /]
               [headertext]Company:[/headertext]
               [tab /]
               [itemheader][a href="http://www.xxxx.com" target="_blank"]xxxxx[/itemheader]
               [br /]
               [br /]

There are appropriate closing tags further down the file.

The CSS that relates to this is:

headertext {
   display: inline;
    color: #008000;
}
itemheader {
    display: inline;
    color: #FFFFFF;
}
list_by {
    font-size: 11pt;
    text-align: center;   
}
preamble {
    font-family: verdana_italic;
    text-align: justify;
    margin-left: 150px;
    margin-right: 150px;
}
sum_title {
    text-align: center;
    font-size: 11pt;
    font-weight: bold;
    color: #FFFF00;
}
text {
    font-family: verdana;
    font-size: 9pt;
    color: #FFFFFF;
}

And finally the Actionscript code:

                                       content_mc.scroll_txt.setTextFormat = tFormat;
                                       content_mc.scroll_txt.embedFonts    = true;
                                       content_mc.scroll_txt.html          = true;
                                       content_mc.scroll_txt.wordWrap      = true;
                                       content_mc.scroll_txt.multiline     = true;
                                       content_mc.scroll_txt.condenseWhite = true;
                                       content_mc.scroll_txt.styleSheet    = myCSS;
                                       content_mc.scroll_txt.text          = sXml;

In order to get the CSS to overide the settings of the dynamic text field I use an empty TextFormat object tFormat.  The XML is loaded with ignoreWhite set to true.

Anybody any ideas ?  Or can I not see the wood for the trees ?

Regards

Rich

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 05, 2011 May 05, 2011

like i said, it may be a bug.

and "unexpected" wasn't a good choice of words.  i expect it because i'm familiar with the issue but you're correct, i didn't expect it when i first encountered it.

Translate
Community Expert ,
May 04, 2011 May 04, 2011

that's expected behavior.  whether that's a flash "bug" or not, i don't know.  but i do know that using tab stops with text that exceeds a certain length causes havoc to your formatting.

the only remedy i know is to adjust your tab stops (and sometimes the width of your textfield) so none of the text exceeds the length flash can handle or use multiple textfields instead of tab stops.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 05, 2011 May 05, 2011

Hi Kglad,

"that's expected behavior."

I would of said that's very unexpected.  I would expect that if the length of text output is less than the next tab stop then it should continue on the same line.  If it's more than the next tabstop then a line break would occur.

I am just wondering if the flash text parser ignores any html that surrounds the output text - that might kind of be a reason since if it doesn't then the length of the text does exceed the next tab stop.  If it does,  the length of the text doesn't exceed the next tab stop.

In anycase,  thanks for the answer,  I'll code a work around.

Regards

Rich

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 05, 2011 May 05, 2011

like i said, it may be a bug.

and "unexpected" wasn't a good choice of words.  i expect it because i'm familiar with the issue but you're correct, i didn't expect it when i first encountered it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2011 May 06, 2011

At least your reply got me moving again.  I've added code to split any long texts into two lines,  whilst keeping the header as 2 by 2 with the extra line as a third line.

Thanks for your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2011 May 06, 2011
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines