linking dynamic html text files  
Author Message
JF213





PostPosted: 2005-2-11 21:12:47 Top

flash-actionscript, linking dynamic html text files I am currently loading an external text file using this code:

loadText = new LoadVars();
loadText.load("text/news.txt");
loadText.onLoad = function(correct) {
if (correct) {
trace("Loaded!!!!");
newsText.html = true;
newsText.htmlText = this.newsBoard;
} else {
trace("file was not loaded!!!");
}
}

This works great. I have 2 questions.
1.) can I add code to a button that makes another section of the text file
load dynamically. For example when the user clicks Bio, the bio section of
that notepad document loads in place of where the news was.
2.) above each date in my news section I want to add a line in my html text
to separate that date of news from another. Can I add cells (like from a
table) and add bg colors in different parts of the cell. b/c if I have a long
this cell with a bg color then that would give me the illusion of a line. or
do I have to create a jpg line and link it in.

Here is my external txt file:
newsBoard=2/10/05<br>We have a new site up and running.
2/6/05<br>we've been working on our new record. it will be out on littlest
sounds sometime later this year. we'll keep you posted.
2/1/05<br>


Thank you I am just learning how to link external txt files.


 
kglad





PostPosted: 2005-2-11 23:52:00 Top

flash-actionscript >> linking dynamic html text files you can't load your textfile in sections. however, you can load several
variables in one text file and display those variables when desired. for
example, in your text file:

news=this is today's news
&&bio=today's personality under the spotlight is...

in your flash you'd load this textfile as before and assign to your textfield
the news string and bio string when you wanted.

 
kglad





PostPosted: 2005-2-11 23:56:00 Top

flash-actionscript >> linking dynamic html text files about your 2nd question: flash has limited support for html tags in its
html-enabled textfield. i don't believe it will support the < hr > tag and it
definitely doesn't support tables. you can always experiment to see what's
supported and you can sometimes use graphics to achieve the effect you want.

 
 
JF213





PostPosted: 2005-2-12 3:17:00 Top

flash-actionscript >> linking dynamic html text files I tried this with no luck. Is it possible to link to multiple vars in one txt
document?

action script:

loadText = new LoadVars();
loadText.load("text/news.txt");
loadText.onLoad = function(correct) {
if (correct) {
trace("Loaded!!!!");
newsText.html = true;
newsText.htmlText = this.newsBoard;
} else {
trace("file was not loaded!!!");
}
}
bio.onRelease=function(){
newsText.htmlText = this.bio;
}
news.onRelease=function(){
newsText.htmlText = this.newsBoard;
}

text file
newsBoard=2/10/05<br>We have a new site up and running.
2/6/05<br>we've been working on our new record. it will be out on littlest
sounds sometime later this year. we'll keep you posted.
2/1/05<br>
&&bio=today's personality under the spotlight is...

 
 
JF213





PostPosted: 2005-2-12 7:17:00 Top

flash-actionscript >> linking dynamic html text files Does that mean that it is better to load a separate txt file each time or is it
possible to break 1 text file into different sections and reference those
sections with different buttons. any help with this would be great or any
links or tutorials explaining this.

Thank you for your help

 
 
NSurveyor





PostPosted: 2005-2-12 8:16:00 Top

flash-actionscript >> linking dynamic html text files You have a referencing problem within your buttons onRelease event. It should
not be this.bio, because this is now your bio button. So, it would be bio.bio.
But, you want the bio variable that belongs to your load vars object. So, you
should use:

bio.onRelease=function(){
newsText.htmlText = loadText.bio;
}
news.onRelease=function(){
newsText.htmlText = loadText.newsBoard;
}


 
 
kglad





PostPosted: 2005-2-12 10:04:00 Top

flash-actionscript >> linking dynamic html text files one text file is sufficient. you can simply load several variables from your one text file and use those variables when needed.
 
 
JF213





PostPosted: 2005-2-13 1:39:00 Top

flash-actionscript >> linking dynamic html text files Perfect...works great. Thank you so much.
 
 
NSurveyor





PostPosted: 2005-2-13 1:45:00 Top

flash-actionscript >> linking dynamic html text files You're welcome.
 
 
kglad





PostPosted: 2005-2-13 5:59:00 Top

flash-actionscript >> linking dynamic html text files likewise.