Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Action for button

Status
Not open for further replies.

brutteforcce

Technical User
Jun 23, 2006
105
RO
I made an action for the buttons of my site and now I want to generalize that action.
This is the action that I used for the first button...

on (rollOver) {
if (release_about_us==0) {

txt_about_us.gotoAndPlay("txt_init");
disp_about_us.gotoAndStop("disp_init");
}
}
on (rollOut) {
if (release_about_us==0) {

txt_about_us.gotoAndPlay("trans_txt");
disp_about_us.gotoAndPlay("trans_disp");
}
}
on (release) {
if (release_about_us==0) {

release_about_us=1;
sa_about_us.gotoAndPlay("selectie_albastru");
select_about_us.gotoAndPlay("selectie_buton");
gotoAndPlay("mutare_meniu");

if (release_products==1) {

txt_products.gotoAndPlay("trans_txt");
disp_products.gotoAndPlay("trans_disp");
release_products=0;
}

if (release_servicii==1) {

txt_servicii.gotoAndPlay("trans_txt");
disp_servicii.gotoAndPlay("trans_disp");
release_servicii=0;
}

if (release_contacts==1) {

txt_contacts.gotoAndPlay("trans_txt");
disp_contacts.gotoAndPlay("trans_disp");
release_contacts=0;
}
if (release_forum==1) {

txt_forum.gotoAndPlay("trans_txt");
disp_forum.gotoAndPlay("trans_disp");
release_forum=0;
}

}
}

I want to change in all of the names the text "about us" in 1, the text "products" in 2 and so forth.
I made this action:

for (i=1; i<5; i++) {
this["buton"+i].onRollOver = function() {
this["txt"+i].gotoAndPlay("txt_init");
this["disp"+i].gotoAndStop("disp_init");
}
this["buton"+i].onRollOut = function() {
this["txt"+i].gotoAndPlay("trans_txt");
this["disp"+i].gotoAndPlay("trans_disp");
}
}
stop();

just for testing if I can use the i variable in all the names and it isn't working...
I hope you understand me, if not ask...
Please try to help me...
Thanks!!!

 
I think this wasn't a good idea... I could take the number of the button from the instance names and then use it where I want... I asked in another thread how can I make that, so this ends here...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top