Groups | Blog | Home
all groups > flash (macromedia) > february 2004 >

flash (macromedia) : HTML into dynamic text boxes


Robert Zwiercan
2/25/2004 10:12:24 PM
I'm trying to load HTML code into a dynamic text box using a text file. I
have no problem doing this when the text box is in the root. When I try and
load it into a text box inside of a movie clip it doesnt work. I name the
path correctly but it doesn't seem to work. Is this even possible to do?
Thanks for any help.

shahgillani
2/26/2004 5:14:45 AM
Hi !
This is shahgillani

Open a new movie press Ctrl+F8 to make a new movie clip draw a dynamic text
box in your new movie clip and give it an instance name "Field1" now open your
component panel and drag scrollbar object into your text field and drop it now
in your only frame paste this code:




// tell Flash to display special characters
System.useCodepage = true;
// set the text field to use HTML tags
Field1.html = true;
// create a new "LoadVars" object
myLoadVar = new LoadVars();
// load the contents of the text file into the LoadVars object
myLoadVar.load("textFile.txt");
// check to see if the loading is completed and, if so, put the contents in
the text field
myLoadVar.onLoad = function(success) {
if (success == true) {
Field1.htmlText = myLoadVar.myText;
}
};


now drag your movie clip onto your stage and drop it. don't forget to save
your document.----------------> Flash work is done.

now create a text file with the name "textFile.txt" on the same root where you
have saved your flash document. and try this text in it





myText= My Text Header...

My text goes here .........


<html>
<font color = "#0000FF">
<a href = "http://www.hotmail.com">Click Here</a>
</font>

</html>
&

now test your movie and your are done.

Regards,
shahgillani
Hassan Sajjad
AddThis Social Bookmark Button