p13
1
How can I adapt this code for use with a button instead of a frame action?
loadText = new loadVars();
loadText.load(“lamplight.txt”);
//creating the loadVarsText function
loadText.onLoad = function() {
scroller.text = this.lamplighttext;
};
I’m using it to load .txt files into a text box. I would like to have two buttons for the user to select the text they want.
Thanks in advance…
-P.
system
2
Howdy…
Are you looking for this???
yourButtonInstance.onPress = function ()
{
// your full code goes here...
}
???
system
3
No, that didn’t seem to work…
Should I attach that code to my button?
-P.
system
4
Um… That’s exactly what I have meanted…
I am using the dot syntax to do the job…
Yes… You sure can use F5 syntax to do it too…
system
5
Unfortunately I’m not sure what I’m doing… Can you be more specific?
-P.
system
6
What I was saying is…
This script put directly into the button instance
on (press)
{
loadText = new loadVars();
loadText.load("lamplight.txt");
//creating the loadVarsText function
loadText.onLoad = function()
{
scroller.text = this.lamplighttext;
};
}
and this script put in the frame
yourButtonInstance.onPress = function ()
{
loadText = new loadVars();
loadText.load("lamplight.txt");
//creating the loadVarsText function
loadText.onLoad = function()
{
scroller.text = this.lamplighttext;
};
}
works the same way… First one is done in F5 format, and the second one is done in FMX format… Know what I mean now???
system
7
That could not have been any clearer! Everything is working now… Thanks a lot! 
-P.