I have several buttons to load different txt files into an textfield. This is action for button1:[AS]loadText = new loadVars();
loadText.load(“textfile.txt”);
loadText.onLoad = function(OK) {
if (OK) {
myText.html = true;
myText.htmlText = this.text1;
}
};[/AS]
The problem is that i have like 30 buttons
Can anyone help me to set a function to make this easier?
well an easy way would be to generate the buttons dynamically (i.e duplicatemovieclip)…
u would just have to make an mc (lets call this “mcWithButton” - set the linkage in the library to this name too…) and put the button in there… take your actions and put em in the first frame of the mc withg the button… change the actions to the following…
just change “_root” to your path from where the function is to the buttons… (dont but the dot between the last part of your path and your “[” brackets… )
oki… put this line of code right after the function I gave you before…
[AS]
_global.setText();
[/AS]
and thats it!
make sure all your buttons are named (Instance Name, not name in library) “button 1” , “button 2” etc…
Also change all the “_root” in the function to the path from where the function is to where the buttons are… so if the buttons are in a movieClip called “menu” on the main scene then change “_root” to “_root.menu” …