View Full Version : ui comp scrollbar dynamic text and html
ptimbo
03-07-2006, 10:26 AM
I've been trying to load text into a flash movie and have it scroll using the UI scrollbar in the MX 2004 comp patch..
I can load and scroll the text fine with this script...
loadText = new LoadVars();
//loading text field in
loadText.load("myDynamicTextField.txt");
loadText.onLoad = function(success) {
if (success) {
myTextArea.wordWrap = true;
myTextArea.text = this.fileText;
} else {
myTextArea.text = "Failed to load Text file, please make sure file is present and try again...";
}
}
My problem comes when i try to render as html.. I have the "render as HTML" button pressed on the text properties and <b>sometext</b> tags around some text..
But the text comes back like this <b>sometext</b> in the movie...
If i take off the scrollbar code posted above.. The HTML formating works..
Does anyone know of a fix for this or a different code for my scrollbar?
Please help!!!
Thanks,
Tim
oldnewbie
03-07-2006, 01:40 PM
You must use htmlText rather than text alone...
loadText = new LoadVars();
//loading text field in
loadText.load("myDynamicTextField.txt");
loadText.onLoad = function(success) {
if (success) {
myTextArea.wordWrap = true;
myTextArea.htmlText = this.fileText;
} else {
myTextArea.htmlText = "Failed to load Text file...";
}
};
ptimbo
03-07-2006, 05:06 PM
Wow... that maks me look really stupid.. lol!
Thanks sooo much for your help.. your gonna laugh when I say this.. but I spent 5 hours trying to find that before I came here..
Thanks again!
-Tim
oldnewbie
03-07-2006, 05:09 PM
Welcome! ;)
ptimbo
03-08-2006, 03:28 AM
Is there a way that I can tell the the text which level in the movie to load to?
Ex: The scrollable text would load to level 2 where the scrollbar and text file are..
The movie im working has many levels.. The level that the swf movie with the this code loads to level 2
loadText = new LoadVars();
//loading text field in
loadText.load("myDynamicTextField.txt");
loadText.onLoad = function(success) {
if (success) {
myTextArea.wordWrap = true;
myTextArea.htmlText = this.fileText;
} else {
myTextArea.htmlText = "Failed to load Text file...";
}
};
Can anyone tell me how to make that load to level 2?
oldnewbie
03-08-2006, 04:14 AM
Are you sure you're talking about levels and not layers and movie clip holders?
And if you are in fact loading external .swfs on levels, are you attempting to use the LoadVars() object in a main movie (_level0) to load some text file in a movie already loaded on level 2?
ptimbo
03-08-2006, 04:26 AM
I dont understand what your asking.. but nothing is preloaded.. you get the content when you click..
Heres what I got
Main moive.. has 5 links on it.. when you click one it uses this code to load a external swf above the main movie..
on (release) {
unloadMovieNum(1);
unloadMovieNum(2);
loadMovieNum("textmovie.swf", 2);
}
Everything is in the same folder..
and this is textmoive.swf.. which works on its own..
loadText = new LoadVars();
//loading text field in
loadText.load("myDynamicTextField.txt");
loadText.onLoad = function(success) {
if (success) {
myTextArea.wordWrap = true;
myTextArea.htmlText = this.fileText;
} else {
myTextArea.htmlText = "Failed to load Text file...";
}
};
But dosent work when its loaded into the Main Movie on level 2
hope that makes sense..
ptimbo
03-08-2006, 08:51 PM
Ok so im an idiot....
I was drunk last night trying to make this work.. and today when i went to make an example everything worked just fine..
I dug through my work and found that at some point in the night.. before I tested everything I felt it necessary to change the name of the text file.. and then make a copy of it.. but not change the tag in that copy.. if that makes sense.. that copy with the bad tag went into the folder for the site.. and the text would load in my test folder when i just tested the one file.. but not in the site folder.. lol
anyway I got it figured out..
I promise i wont come on here asking questions when im drunk anymore..lol
Thanks for all the help oldnewbie
-Tim
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.