How can I update multiple dynamic text fields with deferent instance name in a timeline with 4 frames ?
I have a movieclip named (button) using custom class with same name
1st Frame: - Layer 1: Dynamic text named (txt1) - Layer 2: Dynamic text named (txtbg1) 2nd Frame - Layer 1: Dynamic text named (txt2) - Layer 2: Dynamic text named (txtbg2) 4rd Frame - Layer 1: Dynamic text named (txt4) - Layer 2: Dynamic text named (txtbg4)
Custom class "button" code:
class button extends MovieClip {
function button() { super(); }
function onLoad() {}
function setActivate(tf)
{
delete this.onPress;
delete this.onRelease;
delete this.onRollOver;
delete this.onRollOut;
if (tf)
{
this.gotoAndStop(2);
this.onRollOver = function()
{
this.gotoAndStop(3);
}
this.onRollOut = function ()
{
this.gotoAndStop(2);
}
this.onPress = function ()
{
this.gotoAndStop(4);
}
this.onRelease = function ()
{
if (_currentframe == 4)
{
//CLICKED DO ACTION
}
this.gotoAndStop(3);
};
return;
}
else
{
this.gotoAndStop(1);
}
}
function setButtonText(txt)
{
this["txt1"].text = txt;
this["txtbg1"].text = txt;
this["txt2"].text = txt;
this["txtbg2"].text = txt;
this["txt4"].text = txt;
this["txtbg4"].text = txt;
}
}
In my main Scene I have a movieclip named "main" using same class with same name. In that moviecplip there are included the two buttons say before
Custom class "main" code:
class main extends MovieClip
{
var button1, button2;
function main()
{
super();
}
function onLoad()
{
button1.setActivate(true);
button2.setActivate(true);
button1.setButtonText("OK");
button2.setButtonText("CANCEL");
}
}
Thanks and sorry for my Bad English.