Htmltext External?
Hello folks, I wish to know if its possible to load an external file.txt containing the html code instead of have the htmltext.text="text" into the movie. Thanks a lot for your time
Ultrashock Forums > Flash > ActionScript
Posted on: 2004-08-08
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[F8] Linking To External HtmlText
I need some help linking to an external txt file and rendering the text as html so I can code it easily.
I've tried using Loadvars but I'm obviosly not doing it right. Here's the AS I've tried to use.
myData = new LoadVars();
myData.onLoad = function() {
_root.dest.html = true;
_root.dest.htmlText = this.mainVariable;
myData.load("mehndi.txt");};
mehndi_btn.onRelease = function(){
_root.dest.htmlText("mehndi.txt");
}
Thanks in advance.
Load External HtmlText
Hi - I'm using the attached code to: 1.create a textField, 2.fill it with text from an external html file (updatable1.html). All of this is supposed to happen when I rollover the btn "rollover_btn".
When I test it and rollover the btn, the border for the textField shows up in the correct place but there is no text AND there is no message "Unable to load HTML file".
Can someone please tell me why this isn't working?
TIA your help
jl
Attach Code
rollover_btn.onRollOver = function() {
createTextField("news_txt",99, 20, 47, 300,95);
news_txt.border = true;
news_txt.html = true;
news_txt.multiline = true;
news_txt.wordWrap = true;
news_txt.styleSheet = my_css;
var txt_url:String = "updatable1.html";
myVars_lv.onData = function(src:String):Void {
if (src != undefined) {
news_txt.htmlText = src;
} else {
trace("Unable to load HTML file");
}
};
myVars_lv.load(txt_url);
}
HtmlText Formatting Problem With External .txt File
I'm wrapping up a site that includes the inclusion of a dynamic text file that loads up htmlText from a .txt document. However, while it accepts <p> and <br> tags, it doesn't seem to like <b> tags. When I put them in, the text within the <b></b> tag simply dissappears. That shouldn't be happening. So why is it and what's the fix? Macromedia says you can use <b> tags in your dynamic text, so this makes no sense.
Loading External HTML To HtmlText Field Doesn't Work Properly If The Text Is Not BOLD
I have two textboxes. Both are set as HTML.
The first one has a routine inside the Flash file itself, to fill it up with a list of dates and event names.
This first one generates links that go something like this:
HTML Code:
<a href="asfunction:_root.fillHomeTextBox,load_demo.php">
And when these links are clicked, the load_demo.php contents are properly loaded, and fills the second HTML textbox via the fillHomeTextBox function (I suspect it's not necessary but I'll paste that function here anyway):
ActionScript Code:
fillHomeTextBox = function(url) {
myData2 = new LoadVars();
myData2.onLoad = function(){
trace(this.content);
_root.pages001.page_home.block1.homeTextBox.htmlText = this.content;
};
myData2.load(url);
}
My question is that I cannot get non-bold text to load. It seems like text is only recognized if wrapped inside
HTML Code:
<b> </b>
tags.
I will paste one example of code that works (generated by load_demo.php) that works, and what doesn't work (which I want to work, as I don't want everything in bold).
ALL IN BOLD - Works (I've upcased --here-- the relevant "B" tags for ease of spotting for comparison with the bit of code right after this next one):
Code:
content=<b><font size='25px'>Quinta 13/Set</font><br><font size='20px'>Monsieur Pelota</font></b><br><br><B><font size='12px'><img width='100' height='100' src='dddf3b4.jpg' align='left' hspace='5' vspace='5'>André Soares starts his adventure as a dj in 1998 (...)</font></B>
WITHOUT BOLD IN THE LAST BIT - Stops working (for that part, keeps displaying the first part of text, and the picture):
Code:
content=<b><font size='25px'>Quinta 13/Set</font><br><font size='20px'>Monsieur Pelota</font></b><br><br><font size='12px'><img width='100' height='100' src='dddf3b4.jpg' align='left' hspace='5' vspace='5'>André Soares starts his adventure as a dj in 1998 (...)</font>
I've tried to use SPAN, P... but nothing works. B for some reason, does. This is with Flash 8 and AS 2, by the way.
I am really lost with this, it's been more than 24 hours and I haven't found a solution yet.
Any help is immensely appreciated!
-Ricardo
HTMLText?
this is what I do,
T_TEXTFORMAT = new TextFormat();
T_TEXTFORMAT.font = "VerdanaBold";
T_TEXTFORMAT.size = 10;
T_TEXTFORMAT.color = 0x000000;
function FormatPaneText(TextBox) {
TexBox.html = true;
TextBox.border = true;
TextBox.background = true;
TextBox.backgroundColor = "0xcccccc";
TextBox.multiline = true;
TextBox.wordWrap = true;
TextBox.autoSize = false;
TextBox.embedFonts = true;
TextBox.setNewTextFormat(T_TEXTFORMAT);
TextBox.setTextFormat(T_TEXTFORMAT);
}
MC.createTextField("TXTValue", i+2, 0, TEXTy, paneWidth, 20);
FormatPaneText(MC["TXTValue"]);
myText = eval(PaneName add "Array")[1];
MC["TXTValue"].htmlText = myText;
////////////////////////////////
I have another TextField that this works on, the only difference is that I don't Create that one it's already on stage. But this one I create and the HTML text doesn't appear at all.
Please Help.
Thanks
Maybe I should ad that this text field is then set to a Scrollable Pane
HtmlText And Xml
how can i include html formatted text within an xml document to be loaded into a dynamic text field in flash? I can't seem to get it to work...
thanks,
dave
HtmlText
Does anyone know of a good place to learn about htmlText in the MX text Field? The output html is does not work in a browser. I need to learn more about it and what tags the flash version has.
Thanks,
TheBigOnion
HtmlText
I am trying to format a Dynamic text box using the htmlText option and only a very limited amount of html commands are working. I thought that BOLD Tags and Italic Tags worked with this option. Am I wrong?
Here's what I have done:
1. Create a dynamic text box and mark it for html formating.
2. Create some buttons, that once pressed, place text in the dynamic text box. I have included Bold Tags, which don't work. The only tag that does seem to work is the (<br>), I have enclosed this tag here because I'm not sure if it would be read as html or not within this message.
Thanks for all of your help.
HtmlText <br> Tag
i have a simple text field with html=true and htmlText=hi<br>hi
why does'nt the <br> show
i get:
hihi
i want
hi
hi
i have attached the files im using.
thanks!
HtmlText ?
I want to format specific text in a dynamic texfield to a certain color
The code i am trying to use is
_parent.strCheck_txt.htmlText += "<font color=#ff0000>_</font> different color text";
But this method dose not work... anyone know why? Is there another method i could use
Bug In HtmlText?
ok compare these two html text entries:
T.htmlText = "<P ALIGN="CENTER"><FONT SIZE="20" COLOR="#ED2024">HEADLINE<FONT COLOR="#FFFFFF"> X <FONT COLOR="#8AC056">HERE</FONT></FONT></FONT></P>";
with
T.htmlText = "<P ALIGN="CENTER"><FONT SIZE="20" COLOR="#ED2024">HEADLINE<FONT COLOR="#FFFFFF"> <FONT COLOR="#8AC056">HERE</FONT></FONT></FONT></P>";
If you plug these into a TextField with html text turned on you'll see what it does.
On the first one it works like expected.
On the Second there should be a space inbetween "Headline" and "Here" but it completely ignores the space.
if you use that works fine but this is a dynamic text box i'm using and when you press the space key it does not enter a
Does anyone know how to fix this? or a work arround?
HtmlText
Hey,
Im having trouble getting the htmlText working. It works fine with .text but when I change it to .htmlText the it doesnt appear.
Cant figure out why, any suggestions?
Thanks
HtmlText
[HTML]title_txt.htmlText="<font color=’#FF0000’>hello world</font>"[/HTML]
Why wont this work. I have my textfiled on the stage and the buttons html text is selected in the property panel
Using HtmlText
Hi there.
My_Button.title_txt.text = named[i] + "(NEW)";
With this code I'm adding (NEW) onto the end of what an Array called "named" contains at position "i". The Array contains the names of video clips, so I'm ending up with, for example:
My Video (NEW)
My problem is that I need the "(NEW)" to be in a different colour to the "My Video". Is there any way of doing this?
Thanks
Htmltext And Img Tag
Hi ! I'm trying to load an embed image into an htmltext...
It nearly works here is the code (Flex)
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
[Embed(source="eighth.png")] public var iconEighth:Class;
]]>
</mx:Script>
<mx:TextArea width="100%" height="100%">
<mx:htmlText>
<![CDATA[
<p>You can include an image in your HTML text with the
<img> tag.</p><p><img src='test2_iconEighth' width='30' height='30'
align='left' hspace='10' vspace='10'>Here is text that follows the image.
I'm extending the text by lengthening this sentence until it's long enough
to show wrapping around the bottom of the image.</p>
]]>
</mx:htmlText>
</mx:TextArea>
</mx:Application>
So the image appears but only in the top left corner..... if I use "eighth.png" instead of the linkageID it works perfectly so what is wrong ????
Thanks !
Help On HtmlText...
Hi guys, i used htmlText to load my html text file to the Flash actionscript but the hyperlinking part is not working.
In my html file, i tried to hyperlink e.g:
<a href='http://www.tradenet.gov.sg/trdnet/index.jsp?catName=7&artName=10349&url=/html/32_List_of_Controlled_Goods_-_Exports.html'> to a word, it's not working and the below text would disappear. However, if i wanted to change the url to this:
<a href="http://www.tradenet.gov.sg/trdnet/index_home.jsp? "target="_blank">
Then it's working. So i think the error is due to '&' sign and i tried to use'&' but it's still not working, what should i do? and if i were to use other methods to link complicating url in html file to be loaded in flash, what method should i use?
HtmlText
Hello,
How can I find out size and font of a htmlText string?
Thanks
HtmlText Img
I'm relatively new to AS3 (started work two days ago in it), and I'm having trouble formatting an image in TextArea via htmlText. My goal is to have the image appear to just be there, not in any box. I've tried playing with several properties, and I can't get it.
Attempt 1 was to set the alpha property,
field_area.alpha=0;
This was successful at removing the background on all of my TextAreas that had other html in them, but it made image disappear as well.
Attempt 2 was to set the padding to 0,
field_area.setStyle("textPadding", 0);
field_area.condenseWhite = true;
This was successful again with the TextAreas that had other Html, but seemed to have no effect on the one with the <img> tag.
Any suggestions would be greatly appreciated!
Thanks,
Brian
XML And HtmlText
I have an XML file that I'm loading into an htmlText enabled text field. The XML has HTML throughout it like this:
Code:
<News>
This is some <b>big</b> news.<br><br>And this <i>isn't</i> so big!
</News>
My text field is showing the HTML tags sometimes and not other times. Any suggestions? Thanks.
Selfminded
HtmlText
I need to create a Flash website that retrieves its data from a mySQL database. The client, however, would like the text to have all the basic formatting posibilities of html text. In other words they would like to be able to have some words bold, italic or coloured and text to flow around images.
How do I do this? I am assuming the only way to do this is to make use of html tags and display the text in flash as htmlText but what's the best way to get the html formatted text into the database? Do I create a CMS that uploads the text into the database as html formatted and when I pull it out of the database through PHP will the formating remain intact or become just a long strong? I need some guidance here. Thanks
HtmlText
I have text field and I have htmlText in the properties, and it supports tag '<img>'... but how I use?
An example? because not working with me =/
Thanks,
Mello
[fmx] HtmlText
Hi, i just arrive. I'm brazilian and i think that i'm writing like an indian. ..no matter, sorry about the english.
well, how i align a dinamic text loaded to the right ?? I'm using htmlText..
THANKS
Img Tag For HtmlText
i'm trying to embed smilies into my htmlText for a text field.
i can get one smilie to work. but it always aligns to the left. how do i get it to stay positioned with the text?
also, if i use more than 1, only 1 shows up. what's up with that?
has anyone done this?
thanks
Htmltext?
hi everyone
is it possible to use htmltext to make a word or sentence clickable, to make an a.s. work. i.e. gotoAndStop() or changing a dynamic textfield. Or is there a work around with something like substr() to make the word clickable.
thanks,
Ric
Help On HtmlText
Hi guys, i used htmlText to load my html text file to the Flash actionscript but the hyperlinking part is not working.
In my html file, i tried to hyperlink e.g:
<a href='http://www.tradenet.gov.sg/trdnet/index.jsp?catName=7&artName=10349&url=/html/32_List_of_Controlled_Goods_-_Exports.html'> to a word, it's not working and the below text would disappear. However, if i wanted to change the url to this:
<a href="http://www.tradenet.gov.sg/trdnet/index_home.jsp? "target="_blank">
Then it's working. So i suspect that it's the complicated url behind(got the catName=7&artName=...) that makes the flash unable to read. What should i do?
[fmx] HtmlText
Hi, i just arrive. I'm brazilian and i think that i'm writing like an indian. ..no matter, sorry about the english.
well, how i align a dinamic text loaded to the right ?? I'm using htmlText..
THANKS
HtmlText
Is there a reason a line break <br> would not work in a dynamic textfield?
HTMLtext & The <li> Tag
I am reading data into Flash via PHP/MySQL. The textbox is populated via the script:
ActionScript Code:
nArticle.htmlText += tbNews[i];
where [i] is a value of the array. The problem I'm having is with the < li > tag in that once a record containing this tag is displayed, every record after it is bulleted.
Prior to refreshing the data based on the users selection, I am clearing out the textbox with:
ActionScript Code:
nArticle.htmlText = "";
So, I can't figure out why the bulleted lists continue. What am I doing wrong here??
AS2 - HtmlText + <img> = Bug?
Hi, I have a function which I call in to create an html enabled textfield to show some content and its working perfectly except that while loading there's a split second (before the images inside the html render into the field) where flash shows a white rectangle, the size of the textfield, then it disappears and the content appears.
Here's the function I'm using:
PHP Code:
function createHTMLTf (hld:MovieClip, nam:String, dep:Number, xpos:Number, ypos:Number, wid:Number, hei:Number, txt:String):Void {
var tf:TextField = hld.createTextField(nam, dep, Math.round(xpos), Math.round(ypos), Math.round(wid), Math.round(hei));
tf.antiAliasType = 'normal';
tf.autoSize = 'left';
tf.background = false;
tf.border = false;
tf.embedFonts = true;
tf.multiline = true;
tf.selectable = true;
tf.type = 'dynamic';
tf.wordWrap = true;
tf.html = true;
tf.htmlText = txt;
}
Anyone has experienced this before or knows a workaround?
Can The HtmlText Be Used In The Following Example
I found this example tutorial and it's exactly want I need except the text in the pop-up needs to be htmlText in order to incorporate a couple hyperlinks inclusive of some additional text.
Based on the follwing example can this be done?
example
Thank you.
+ And % In HTMLtext Field
Okie, feeling stupid,
what do i need to do to display + and % symbols in a html text field,
Thanks,
Chi
HtmlText And Hyperlinks
Hey guys, maybe some of you can help with a question i have.
im loading information from a database, and displaying it in an htmlText text field...that in itself is fine, the thing is the hyperlinks which will bring up the more detailed information of the event opens up in a new window.
Ideally i want to call a function that tells a movie clip to play and load the required details, (and im sure i have seen some solution to this somewhere but cannot find it now) but i dont know if or how this is possible using the html formatting within this text field.
thanks in advance
HtmlText And TextField
I am trying to load htmlText into a textField from a xml file. The htmlText contains wingdings font.
I use the following code.
_root.createTextField("myText",1,100,100,300,100);
myText.html = true;
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
myText.htmlText = this.firstChild.firstChild.nodeValue;
}
myXML.load("test.xml");
The test.xml is as follow.
<item>
<![CDATA[<p align="center"><H4 align="center"><b>
<font face="WINGDINGS"><font color="#000080">a</font></font>
<font face="ARIAL"><font color="#000080">——</font></font>
<font face="WINGDINGS"><font color="#000080">a</font></font></b></H4></p>]]>
</item>
However, all the text in the textField appear in Arial font.
Can anyone tell me how to display Wingdings font as well as other fonts properly with htmlText?
Thank you very much!!!
HtmlText + Hyperlinks
Hello,
I'm trying to highlight the hyperlinks in a htmlTextField in flash, when the user already visited this link. but I can't find a solution.
Does anyone here have an idea, or already did this.
I would realy appreciate it.
Kind regards
Htmltext, Access DB And ASP?
i'm trying to create a news page in my flash website.
I can have a ASP script that reads stuff from a Access database but how can i have all those results displayed in flash? using a box .htmltext or duplicatemovieclip?
I would have something like
date:
Title:
Content:
10/10/03
New somthign addes
asdf asdf asdf asdf asdf asdf
10/09/03
Another news
asdfasdfasdfasdfasdfasdf
10/07/03
Another news
asdfasdfasdfasdfasdfasdf
All that inside a txt box
thanks!
Htmltext Question
If you check out jweintraub.com and click on the portal button the text in my dynamic text box will not render the html, however if you click on either profile or resume then click on portal it does render the html.
Any ideas as to why that is happening. The only thing I can think of is that there are a lot more links in the portal text file
Any help would be appreciated
Any Way To Style HtmlText In FP6?
I know FP7 supports CSS for htmlText in dynamic fields. But whatabout FP6? Is there any way to, for instance, color links differently etc, inside a dynamic text field in Flash Player 6? I guess you could do a lame font color= tag but then there's no hover interactivity.
[MX] HtmlText Loop
Using this loop
Code:
for (i=1; i<=pageTotal; i++) {
_root.page_txt.htmlText += "<b> " + i + "</b>";
}
I get these results in my text file
1
2
3
Whereas I'd like the results to stay on the same line and come out as
1 2 3
Is there a way I can do this?
Textfield.htmlText
I've done some research in Moock's Actionscript for Flash MX, but still running into issues.
I have text variables being passed into my flash movie that need to be in the same paragraph but can be one of 3 types: title, url, blank. Each one goes on a separate line. My code seems to be creating the html string properly, and when I create a textbox with the authoring tool, instead of with code, and set it to html = false, it displays the html string. However, when I enable html, it displays nothing.
Next I tried creating a text field with code, however, it still will not display the text. One thought is that there is a limit on how many characters a string can hold? If so, what do I use instead? My code is below:
Make the text string (this works fine)
Code:
function makeText(){
for(i=1; i<=13; i++){ //13 is the number of lines available for display
if(_root["linksAkey_"+i] == 0){ //blank line
_root.Astring += '<BR>';
}else if(_root["linksAkey_"+i] == 1){ //title line
_root.Astring += '<FONT COLOR=#B5BD8E>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</FONT><BR>';
}else if(_root["linksAkey_"+i] == 2){ //url line
_root.Astring += '<FONT COLOR=#FFFFFF><U><A HREF=http://';
_root.Astring += _root["linksAurl_"+i];
_root.Astring += '>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</A></U></FONT><BR>';
}
}
}
Make the textbox and display _root.Astring (not working)
Code:
this.createTextField("linksA", 10, 10, 162, 150, 209);
this.linksA.html = true;
this.linksA.htmlText = _root.Astring;
this.linksA.type = "dynamic";
this.linksA.embedFonts = true;
this.linksA.setTextFormat(_root.typewriter12);
this.linksA.multiline = true;
this.linksA.wordWrap = true;
Htmltext And GetCaretIndex
Does anyone know of a good hack to retreive the caret position of a textfield_txt.htmlText, based its textfield_txt.text position?
Dos
Problems With HtmlText
I have some html text that I am dynamically generating that involves the concatenation of variables.
Only the first part of the message is displayed.
here is the code:
***********************************
for (b=1;b<=crank;b++){
temp= ["<img src=rightarrow.gif align='left'> "+ _root.benefits[b] + "<br>"];
benefitoutput=benefitoutput+temp;
}
tmessage="<b>Key benefits : </b><br>"+benefitoutput;
_root.output.html=true;
_root.output.htmlText=tmessage;
***********************************
In this situation, html formatting is on, but it only displays the words "Key benefits" The rest, which is a bunch of concatenated stuff, is not displayed at all.
Does anyone know why this is happening and how to fix??
Mytext.htmlText
Hello
i've got a dynamic text field with var=strProduct (from the database:http://www.address.com)
i would like to get this text as an url into mytext field
i know it's something like this, i can try to put the var into it but no succes, idon't know how to organized the var. thank's
mytext.htmlText="<a href='.......'>........<a>"
it's not working at all
on my first frame
onClipEvent(data)
{
strName = Name;
strTelephone = Telephone;
strCity = City;
str Product = Product;
strNotes = Notes;
strPosition = "Record " add String(CurrentRecord+1) add " of " add String(TotalRecords);
}
onClipEvent(load)
{
CurrentRecord = 0;
loadVariables ("getdetails.asp?Record=0", this);
}
thank's 4 reply
xcear
HtmlText Problem
I have a textField and I am using it's .htmlText property. when i set preferences to flash player 6 '<br>' tags do what they are supposed to do and create a new line. if i set preferences to flash player 7 the '<br>' tag does not work. anyone know why. i need to use player 7 becase i need to be able to modify the context menu; so using player six is not an option.
thanks
.htmlText Links(MX)
I am tryng create a links page using .htmlText but cant get it working.
The information is loaded from a .txt which appears to work ok.
I have attached the .fla and .txt files, if someone can show me where im going wrong it would be much appreciated!
HtmlText Leading And XML
I'm importing a restaurants menu written in XML but it seems it is adding a few extra hard returns between nodes.
If I use a couple lines like this
Code:
<dish4>
Gourmet Pizzas with Basil Pesto, Mozzarella, and Goat Cheese Tomato Sauce also available
</dish4>
<dish5>
Chicken Satay with Toasted Coconut, Almonds and a Ginger Soy Dipping Sauce
</dish5>
There will be two hard returns between each entry. How do I change that?
HtmlText Align
how do i align with htmlText? Im using MX.
i have:
code: _root.textMC.htmlText = "<b>Hello World</b>";
how do i align it? centre right etc.
HtmlText Using Br BIG PROBLEM
Hello
I am using flashMX 2004, and I am typing the attached code:
_root.createTextField("t_txt", 0, 20, 20, 0, 0);
t_txt.autoSize = true;
t_txt.condenseWhite = true;
t_txt.selectable = false;
t_txt.html = true;
t_txt.htmlText = "hi<br>hi";
the resault is shown with no new line : "hihi". if i set the player to be flash 6.0 the new line is shown. how can i fix the bug/problem?
PLEASE HELP
ADI
HtmlText Shows Nothing
I have 3 dynamic text fields vertically aligned, and one of them needs to be able to link to another web page. So I figured an easy way to do this would be to make it an HTML field.
Here is my code:
Code:
_root.text_Client = myImagesInfo[theNumber].imageClient;
_root.text_Title = myImagesInfo[theNumber].imageTitle;
_root.text_Agency.html = true;
_root.text_Agency.htmlText = '<a href="'+myImagesInfo[theNumber].agencyURL+'">'+myImagesInfo[theNumber].imageAgency+'</a>';
text_Client and text_Title work just fine. However, the there is no text in the third dynamic text field.
If I do remove the htmlText:
Code:
_root.text_Agency = '<a href="'+myImagesInfo[theNumber].agencyURL+'">'+myImagesInfo[theNumber].imageAgency+'</a>';
I see everything, the text and the HTML (html is not rendered).
Any ideas? I'm not sure what else to try...
Thanks
Tyler
|