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

Text-Indent with XML/Hml Text bug

Guest
Jan 29, 2009 Jan 29, 2009
Hi, this problem has been bugging me and many students here.
I'm importing text from a .xml file, in tat file my text is formatted with HTML and an imported StyleSheet.


The problem is...

Image

The indentation shown here by the red rectangle...
I tried to remove it while using text-indent:0; in my css... didn't work..

I am really clueless righ now.
Thanks for the help.
TOPICS
ActionScript
3.6K
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 ,
Jan 29, 2009 Jan 29, 2009
i'm not sure what you're trying to do but the position of the red/purple rectangles is dependent on the way you're embedding your swfs in the html file and not dependent on a stylesheet.
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
Guest
Jan 29, 2009 Jan 29, 2009
Sorry. I think I didn't explain this the right way...

The red rectangle aren't there, nin my swf... they are just on the image to show that there is a text-indent that isn't supossed to be there.

It look like every time I do a line break... (with a tag like a P or a H1) there is an indent that appear when it shoudn't.
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 ,
Jan 29, 2009 Jan 29, 2009
are you trying to precisely position text within a textfield that also contains an image?

if so, are you using cs4?
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
Guest
Jan 29, 2009 Jan 29, 2009
No I ain't trying to position a textfield who got an image... i'm just trying to get rid of that indentation over the first line of eacht new statement.

I'm using Flash CS3 and everything is done trough programmation
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 ,
Jan 29, 2009 Jan 29, 2009
do you have text and images (dark red rectangle) in one textfield?

actually, show me your code that assigns text or htmlText to your textfield and show the definition of all strings used in that assignment statement.
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
Guest
Jan 29, 2009 Jan 29, 2009
The rectangle arent even in the flash, i just put them there to show you that there is an indentation -_-
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
Mentor ,
Jan 29, 2009 Jan 29, 2009
regardless if the rectangle is there or not, i think you should be posting your code to move your topic along.
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
Guest
Jan 29, 2009 Jan 29, 2009
xmlText = loading.getXML("bois");
xmlText.ignoreComments = false;

//Changer le bgHolder par textHolder
contText = new TextField();
contText.embedFonts = true;
contText.selectable = false;
contText.defaultTextFormat = txtSection;
contText.autoSize = TextFieldAutoSize.LEFT;
contText.x = 100;
contText.y = 145;
contText.text = xmlText.section.text();
bgHolder.addChild(contText);

contText = new TextField();
contText.selectable = false;
contText.defaultTextFormat = txtConte;

contText.wordWrap = true;
contText.width = 350;
contText.height = 300;
contText.x = 100;
contText.y = 170;
contText.styleSheet = style;
contText.htmlText = xmlText.contenu.toString();
bgHolder.addChild(contText);


if this can 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 ,
Jan 29, 2009 Jan 29, 2009
the problem(s) are in getXML() (especially check your parsing) and/or your external xml or text file and possibly your stylesheet.
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
Guest
Jan 30, 2009 Jan 30, 2009
If I knew already what to search for it would kinda help me... you really aren't of any help right now :S
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 ,
Jan 30, 2009 Jan 30, 2009
sorry. i'm having a little trouble reading that code and stylesheet.
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 ,
Feb 26, 2009 Feb 26, 2009
Hi Xaren,
Did you ever resolve this problem?

I have a similar one. Have loaded text into htmlText property of a textfield and it displays a one character space at the beginning of each line.

Can't seem to find a way to remove 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
Guest
Feb 26, 2009 Feb 26, 2009
No I never did... and even after many hours of search I didn't find anthing related to that...
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
LEGEND ,
Feb 26, 2009 Feb 26, 2009
What you are seeing is a paragraph indent. The code that you show from 1/30 shows the setup of two textfields, both named contText. The problem is most likely in the original xml node that contains the text, or it may be in the stylesheet that you are using. If you show those to us, someone may be able to find the problem.
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
Guest
Feb 26, 2009 Feb 26, 2009
Here it is
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
LEGEND ,
Feb 26, 2009 Feb 26, 2009
I'm guessing that the default interpretation of the h1,h2,h3,h4 attributes may be the reason for those items being indented. There's nothing in this code that would cause any of those lines to indent.

There is some weirdness in the way that Flash reads html text. There are many bugs. As a test, you might remove all of the h tags and replace those with p tags and see if the formatting changes. My guess is that it will.
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
Guest
Feb 26, 2009 Feb 26, 2009
Already tried that, as of now my only guess is that opening a tag result in an indentation.
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 ,
Nov 15, 2010 Nov 15, 2010

I had the same problem - have dynamic text fields created in Flash, load external CSS to format the text from XML file. The first line in text fields is always indented. I tried all the techniques including xml.ignoreWhitespace set to true and others. Nothing helped. When debugging the xml string in FDT it turns out there are linebreaks "\n" symbols that get inserted into my strings. Well, the only solution I was able to find is to wrap all my html tags in XML into CDATA tags.

Like so:

<header><![CDATA[<h3>Design</h3>]]></header>

<text><![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sed velit nibh. Nullam vitae ipsum a ipsum dictum viverra. Vivamus.</p>]]></text>

Watch out for spaces between the <![CDATA[ and <h3> tags and the text itself. Because if you insert one, it will look like an indent and you might spend another couple hours thinking it didn't work

Hope this helps someone else as well.


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 ,
Oct 11, 2011 Oct 11, 2011
LATEST

Same problem here - fortunately managed to solve it by setting 2 properties of the XML class:

XML.prettyIndent = 0;

XML.prettyPrinting = false;

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/XML.html#prettyIndent

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/XML.html#prettyPrinting

I guess this is a problem surfacing through implicit casting of xml objects to strings...

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