Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

load .txt file into a dynamic text field with scrollbar 1

Status
Not open for further replies.

martinb7

Programmer
Jan 5, 2003
235
GB
Hi, i was wondering how to make a movieclip - loader
(onClipEvent(load)) load news.txt into a dynamic text field (var = rinfo) and make it scrollable.
Use scrollbar to scroll the text when loaded into the text box.

I have been trying for ages, but cant get it working.

Help Me :)

Martin

PS. if you could make me a .fla for me to download it would be helpful
 
why does it have to go into a clip? 2 secs to make an fla if you have mx.
 
hey...i have sort of the same question / problem too.. can u please help me? I get that one but it's only plain text, wut if i want to add like colors and things to the text?

abiem@shaw.ca
icQ: 9313923

it'd b great if u can help me asap..thanks!! =D
 
Hi umm..I have another problem...=( I have 2 section for the dynamic text..liek 2 different fields in the same movie that would load different texts itself....

here's my first set of code:

// loading this movie into an empty clip named 'hold'
// set up load function and format objects
mydata = new loadvars();
mydata.onload = function() {
_root.update1.html = true;
_root.update1.htmlText = mydata.theText;
_root.update1.border = false;
_root.update1.borderColor = "0x000000";
_root.update1.background = false;
_root.update1.backgroundColor = "0x345678";
scrollBar.setScrollTarget(_root.update1);
};
// format scrollbar
formStyleFormat = new FStyleFormat();
formStyleFormat.scrollTrack = "0x123456";
formStyleFormat.highlight = "0x000000";
formStyleFormat.highlight3D = "0x000000";
formStyleFormat.arrow = "0xffffff";
formStyleFormat.face = "0x003366";
formStyleFormat.background = "0x123456";
formStyleFormat.shadow = "0x000000";
formStyleFormat.darkshadow = "0x000000";
formStyleFormat.addListener(scrollBar, dropdown);
formStyleFormat.applyChanges();
// change handler for combobox and set up
mydata.load("update.txt");
dropdown.setSelectedIndex(0);
dropdown.setChangeHandler("loadthis");
function loadthis() {
var loadText = dropDown.getSelectedItem().data;
mydata.load(loadtext);
}


its' called "update1"

and i have another set of code..and it didnt show up so i thought i should change mydata to mydata2 in the second set? so here it is...


// loading this movie into an empty clip named 'hold'
// set up load function and format objects
mydata2 = new loadvars();
mydata2.onload = function() {
_root.update2.html = true;
_root.update2.htmText = mydata2.theText;
_root.update2.border = false;
_root.update2.borderColor = "0x000000";
_root.update2.background = false;
_root.update2.backgroundColor = "0x345678";
scrollBar.setScrollTarget(_root.update2);
};
// format scrollbar
formStyleFormat = new FStyleFormat();
formStyleFormat.scrollTrack = "0x123456";
formStyleFormat.highlight = "0x000000";
formStyleFormat.highlight3D = "0x000000";
formStyleFormat.arrow = "0xffffff";
formStyleFormat.face = "0x003366";
formStyleFormat.background = "0x123456";
formStyleFormat.shadow = "0x000000";
formStyleFormat.darkshadow = "0x000000";
formStyleFormat.addListener(scrollBar, dropdown);
formStyleFormat.applyChanges();
// change handler for combobox and set up
mydata2.load("update2.txt");
dropdown.setSelectedIndex(0);
dropdown.setChangeHandler("loadthis");
function loadthis() {
var loadText = dropDown.getSelectedItem().data;
mydata2.load(loadtext);
}



but it doesnt work...=( can u tell me what's wrong?

Also another host movie loads this dynamic-text movie. and for some reason when the host movie loads this text movie the texts doesnt show up but if i just open the text movie itself the texts loads properly =(
 
you have 2 different change handlers for the combo box thats one thing thats wrong

why not just drop the combo box and load the text diretly into the textboxes.
 
Delete the combobox then use this code in the main timeline


mydata = new loadvars();
mydata.onload = function() {
_root.update1.html = true;
_root.update1.htmlText = mydata.theText;
_root.update1.border = false;
_root.update1.borderColor = "0x000000";
_root.update1.background = false;
_root.update1.backgroundColor = "0x345678";
scrollBar.setScrollTarget(_root.update1);
};
// format scrollbar
formStyleFormat = new FStyleFormat();
formStyleFormat.scrollTrack = "0x123456";
formStyleFormat.highlight = "0x000000";
formStyleFormat.highlight3D = "0x000000";
formStyleFormat.arrow = "0xffffff";
formStyleFormat.face = "0x003366";
formStyleFormat.background = "0x123456";
formStyleFormat.shadow = "0x000000";
formStyleFormat.darkshadow = "0x000000";
formStyleFormat.addListener(scrollBar);
formStyleFormat.applyChanges();
mydata.load("update.txt");

mydata2 = new loadvars();
mydata2.onload = function() {
_root.update2.html = true;
_root.update2.htmText = mydata2.theText;
_root.update2.border = false;
_root.update2.borderColor = "0x000000";
_root.update2.background = false;
_root.update2.backgroundColor = "0x345678";
scrollBar2.setScrollTarget(_root.update2);
};
// format scrollbar2
formStyleFormat = new FStyleFormat();
formStyleFormat.scrollTrack = "0x123456";
formStyleFormat.highlight = "0x000000";
formStyleFormat.highlight3D = "0x000000";
formStyleFormat.arrow = "0xffffff";
formStyleFormat.face = "0x003366";
formStyleFormat.background = "0x123456";
formStyleFormat.shadow = "0x000000";
formStyleFormat.darkshadow = "0x000000";
formStyleFormat.addListener(scrollBar2);
formStyleFormat.applyChanges();
mydata2.load("update2.txt");

 
combo box you mean the dynamic text box?.....but dont i need that?....
i just copy and pasted the first text box and changed the codes for the second box, that's okay right?

so only
dropdown.setSelectedIndex(0);
dropdown.setChangeHandler("loadthis");
function loadthis() {
var loadText = dropDown.getSelectedItem().data;

is taken out and changed in the text? what did those 4 lines do before then? how come we dont need them any more....
 
those lines are for either a list box or a combobox...they have nothing to do with a text box. the code above will load 2 textfiles (update.txt and update2.txt) into 2 dynamic text boxes with instance names update1 and update2 and scrollbars, scrollbar and scrollbar2
 
wow genius at work.. kool bill. just a small problem with me too. i have a dynamic text loaded frm external file through loadVars("filename",0); but since the text is too big i tried to put a scroll bar. it sometimes works sometimes not.. i dont know wats the problem is.. so i just deleted it and used the scrolling buttons insted.. to scroll the text through action script.

so could u please tell me how can i make that silly scroll bar to work. fine...
regards
 


Regards,

cubalibre2.gif
 
hi bill...i've looked @ it but i still dont get how to load up my 2nd txt file...can u help me? here's my files =( and please tell me what's wrong

unpossiblestudio.com/abiem/update.zip
 
it works great! thanks =)

but umm..I have another small problem =( I tried to custmize the scrollbar with my own grpahics..I think i have everythign working except the "bar" that u click on to scroll i dont know where to replace that can u help me again?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top