Why objects?

Why do we need to create objects like Sound Objects, Date Objects and Text Objects before we load them? And what are the advantages of using objects?

 
//date
mydate = new Date();
date = mydate.getDate();
//sound
soundtrace = new Sound();
soundtracl.attachsound(_level1)
//text
loadText = new loadVars();
loadText.load("text1.txt");

Because you can’t load something into nothing.
You’ll need to create a new object before you an use it.

good point

so what code do i use to replace the object with something else…like replace “text1.txt” with “text2.txt”? :slight_smile:

is it just

 
loadText.load("text2.txt"); 

don’t bother answering, i’ll test it for myself :stuck_out_tongue:

replace what with what now? :h:
replace a string with another string?
replace the content of text1.txt with the content of text2.txt?

text1.txt = text2.txt;

ic, thx

just call load again with the new textfile

got it, thx