all groups > flash (macromedia) > april 2006 >
You're in the

flash (macromedia)

group:

html formatting issues


html formatting issues KelDev
4/19/2006 9:22:19 PM
flash (macromedia): I am trying to create some html formatting within a dynamic text area.

First What is the deal with img tags.

Why DOES THIS WORK and render the image

myBox.htmlText="xx<img src='Home.gif' />"

AND

myBox.htmlText="<img src='Home.gif' />"

DOES NOT render the image???????????????????????????


Here is my snippet of code

exampleText = "";

for (var i:Number = 0; i<=xmlcount-1; i++) {
//trace("this.myDataSet, xml = " + myDataSet.CompanyName);
exampleText += "<br>x"+ myDataSet.CompanyName + "x<img src='Home.gif' />"

myDataSet.next();

}
my_txt.tabEnabled=false;
my_txt.html = true;
my_txt.border =true;
my_txt.htmlText = exampleText;
trace(my_txt.htmlText);

As you can see i am only using a simple <br> in the code

BUT

the my_txt.htmlText in the text area is

<TEXTFORMAT LEADING="2">
<P ALIGN="LEFT">
<FONT FACE="Verdana" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">
</FONT>
</P>
</TEXTFORMAT>
<TEXTFORMAT LEADING="2">
<P ALIGN="LEFT">
<FONT FACE="Verdana" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">
xKeldevx
<FONT SIZE="2">
<IMG SRC="Home.gif">
</FONT>
</FONT>
</P>
</TEXTFORMAT>
<TEXTFORMAT LEADING="2">
<P ALIGN="LEFT">
<FONT FACE="Verdana" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">
xfffffffx
<FONT SIZE="2">
<IMG SRC="Home.gif">
</FONT>
</FONT>
</P>
</TEXTFORMAT>
<TEXTFORMAT LEADING="2">
<P ALIGN="LEFT">
<FONT FACE="Verdana" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">
x100x
<FONT SIZE="2">
<IMG SRC="Home.gif">
</FONT>
</FONT>
</P>
</TEXTFORMAT>
<TEXTFORMAT LEADING="2">
<P ALIGN="LEFT">
<FONT FACE="Verdana" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">
x100x
<FONT SIZE="2">
<IMG SRC="Home.gif">
</FONT>
</FONT>
</P>
</TEXTFORMAT>


WHERE ARE ALL THESE OTHER TAGS COMING FROM????????????????????
WHY DOES THE FORMAT JUST PLAINLY LOOK BAD AND DOES NOT FIT WHAT I AM SENDING
IT??
CAN I TURN THIS OTHER STUFF OFF SOMEWHERE????

In conclusion I have been pulling my hair out all day. I have read hundreds
of site examples and nothing seems to work when formatting a html text box. I
tried css but then the image will not show up.

WHAT IS THE DEAL??? WHY is somwething so simple so stupidly hard.

PLEASE OH PLEASE HELP

Thanks.
Re: html formatting issues mckinleymedia
4/20/2006 11:45:41 PM
I struggled with this ad nauseum a while back myself. The number of HTML tags
that work is very restrictive. If you put in the wrong stuff, it may cancel
out everything else. Watch out for nested styles, they can choke Flash. Also,
I found that I couldn't get Flash to recognize vertical spacing with my <p>'s,
so I had to add <br>s for spacing. I'm a bit of a purist, so this bugged me,
but oh well....

I made this site with the intention of using HTML in each of the text fields:
http://www.tamhighfoundation

My intent was to create a system wherein I could save individual txt files
with the page contents. These txt files would have HTML. I ended up having so
much trouble that I cut all the HTML down to the basics. I AM using CSS. I
grab the text from a txt file. Below is what I now use for this case. You put
that code in frame 1:

// define documents used
var pageContent = "content.txt";
var cssURL = "core.css";

//Create a new style sheet object
var myCSS = new TextField.StyleSheet();
myCSS.load(cssURL);

// basic setup of content textbox
pageContentBox1.html=true;
pageContentBox1.multiline=true;
pageContentBox1.wordWrap=true;
pageContentBox1.selectable=true;
pageContentBox1.condenseWhite=true; // I like to have readable HTML
pageContentBox1.mouseWheelEnabled=true; // makes it nice for scroll wheels
pageContentBox1.autoSize = true;

loadedText = new LoadVars();

// I like onData versus onLoad, that way I can have just HTML in a plain text
file
loadedText.onData = function(raw) {
pageContentBox1.styleSheet = myCSS;
pageContentBox1.htmlText = raw;

}
loadedText.load(pageContent);


----

Then name the "instance name" of a text box: "pageContentBox1". Note that the
text box must exist in frame 1.

Anyway, I hope that'll help you.

Cheers,

--Will

will@mckinleymedia.com
AddThis Social Bookmark Button