Groups | Blog | Home
all groups > flash actionscript > july 2004 >

flash actionscript : loadVariables



OrangeHeart1
7/25/2004 8:12:45 PM
Ok another stupid question!
This is my first flash site and i?m having trouble with understanding the
whole e dynamic text. I have figured out how to upload the text into the
dynamic text box but I?m having trouble figuring out how to upload other text
files into the same dynamic box by the button on click.


For example, I have this loadVariables("index.txt", this); to load up my blog
into the dynamic text. But I have other buttons that I would like to load
different text files into the same area. I tried the ?on (release)? with the
text file name and with the ?this? but it didn?t work.

Any suggestions on what I could be doing wrong?
http://www.orangeheart.com/gm1.3/work.htm
delella
7/25/2004 8:40:11 PM
I would suggest populating the text file like such:

myData=something you want as the variable goes here&

In flash you load the textfile using LoadVariableNum("myText.txt", 0).....this
loads the text file and the variable myData into you flash movie.....the
dynamic text block should reference the variable myData......to make the other
buttons load different data you use the same variable name but different text
document name and different data:

myData=the other information goes here...this is a new text file name as well.&

So on the new button click all you need is:
on(release){
loadVariableNum(newtext.txt", 0);
}

Hope this helps
Jack.
7/25/2004 9:40:13 PM
can you make use of this approach -

function loading(id){
lv = new loadVars();
lv.onLoad = function(){
field1.html = true;
field1.htmlText = this.txt;
};
lv.load(id +".txt");
};

loading("t1");

btn1.onPress = function(){loading("t1") };
btn2.onPress = function(){loading("t2") };
btn3.onPress = function(){loading("t3") };

/*t1.txt - txt=<b>bold&
t2.txt - txt=<i>italic&
t3.txt - txt=<u>underline& */

hth
AddThis Social Bookmark Button