Може ли този код да се напише по-кратко:
Код:
//
nextButton1.owner = this;
nextButton1.label = "1";
nextButton1.setStyle("fontWeight","bold");
nextButton1.useHandCursor = false;
// define the click
nextButton1.clickHandler = function() {
nextButton1.useHandCursor = false;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","bold");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = 300;
search();
};
nextButton2.owner = this;
nextButton2.label = "2";
nextButton2.useHandCursor = true;
// define the click
nextButton2.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = false;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","bolt");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -600;
search();
};
nextButton3.owner = this;
nextButton3.label = "3";
nextButton3.useHandCursor = true;
// define the click
nextButton3.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = false;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","bolt");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -1500;
search();
};
nextButton4.owner = this;
nextButton4.label = "4";
nextButton4.useHandCursor = true;
// define the click
nextButton4.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = false;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","bolt");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -2400;
search();
};
nextButton5.owner = this;
nextButton5.label = "5";
nextButton5.useHandCursor = true;
// define the click
nextButton5.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = false;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","bolt");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -3300;
search();
};
nextButton6.owner = this;
nextButton6.label = "6";
nextButton6.useHandCursor = true;
// define the click
nextButton6.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = false;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","bolt");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -4200;
search();
};
nextButton7.owner = this;
nextButton7.label = "7";
nextButton7.useHandCursor = true;
// define the click
nextButton7.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = false;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","bolt");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -5100;
search();
};
nextButton8.owner = this;
nextButton8.label = "8";
nextButton7.useHandCursor = true;
// define the click
nextButton8.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = false;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","bolt");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -6000;
search();
};
nextButton9.owner = this;
nextButton9.label = "9";
nextButton9.useHandCursor = true;
// define the click
nextButton9.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = false;
nextButton10.useHandCursor = true;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","bolt");
nextButton10.setStyle("fontWeight","normal");
premesti_x = -6900;
search();
};
nextButton10.owner = this;
nextButton10.label = "10";
nextButton10.useHandCursor = true;
// define the click
nextButton10.clickHandler = function() {
nextButton1.useHandCursor = true;
nextButton2.useHandCursor = true;
nextButton3.useHandCursor = true;
nextButton4.useHandCursor = true;
nextButton5.useHandCursor = true;
nextButton6.useHandCursor = true;
nextButton7.useHandCursor = true;
nextButton8.useHandCursor = true;
nextButton9.useHandCursor = true;
nextButton10.useHandCursor = false;
nextButton1.setStyle("fontWeight","normal");
nextButton2.setStyle("fontWeight","normal");
nextButton3.setStyle("fontWeight","normal");
nextButton4.setStyle("fontWeight","normal");
nextButton5.setStyle("fontWeight","normal");
nextButton6.setStyle("fontWeight","normal");
nextButton7.setStyle("fontWeight","normal");
nextButton8.setStyle("fontWeight","normal");
nextButton9.setStyle("fontWeight","normal");
nextButton10.setStyle("fontWeight","bolt");
premesti_x = -7800;
search();
};