i used this AS to load external text (load on its own)
[AS]
loadTexts = new loadVars();
loadTexts.load(“speaknote.txt”);
loadTexts.onLoad = function() {
textBox.text = this.speaknote;
};
[/AS]
how can i modify this AS so that it will load when i press a button
i try to change it to this
[AS]
loadTexts = new loadVars();
loadTexts.load(“speaknote.txt”);
buttonToLoad.onPress = function() {
textBox.text = this.speaknote;
};
[/AS]
whats wrong with this AS, why it wont work?
system
August 2, 2003, 3:29pm
2
[AS]function loadText() {
loadTexts = new loadVars();
loadTexts.load(“speaknote.txt”);
loadTexts.onLoad = function(success) {
if (success) {
textBox.text = this.speaknote;
} else {
textBox.text = “Error loading data”;
}
};
}
buttonToLoad.onPress = loadText;[/AS]
system
August 2, 2003, 3:52pm
3
claudio,
it load before i can press the button
system
August 2, 2003, 3:58pm
4
Weird… It should work. :-\
system
August 2, 2003, 4:09pm
5
loadTexts.onLoad = function(success) {
if (success) {
textBox.text = this.speaknote;
doesnt this part show that if the frame is load
the the text will appear?
system
August 2, 2003, 4:17pm
6
Nope because im only calling the function on button press.
Check my attached file
system
August 2, 2003, 4:58pm
7
thanks for your help. its ok now