Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:51:38+00:00 2026-06-12T22:51:38+00:00

I have 180 buttons in one Flash file and for all buttons I need

  • 0

I have 180 buttons in one Flash file and for all buttons I need a roll over and a click event, so the code I`m using is:

button1.onRollOver = function() { //on roll over change button color as white
  var color = new Color(button1); 
  color.setRGB("0xFFFFFF"); 
};
button1.onRollOut = function() { //on roll out reset button color to it`s default
  resetColorFunction(); 
};
button1.onPress = function() { //on click/press runs javascript function in page
  getURL("javascript:ButtonPress('button1');"); 
};

The problem is that I have 180 buttons, so I`m copying this code to each button, button1, button2, button3, button4 …etc until button180.

Is there any way to loop through all buttons with one simple code, function.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:51:39+00:00Added an answer on June 12, 2026 at 10:51 pm

    You can use eval in Actionscript 2 to get all your buttons tagged with minimal effort.

    buttonRollOver = function() { ... };
    buttonRollOut = function() { ... };
    buttonPressed = function() { ... };
    
    for (var i=1; i<181; i++)
    {
       eval("button"+i).onRollOver = buttonRollOver;
       eval("button"+i).onRollOut = buttonRollOut;
       eval("button"+i).onPress = buttonPressed;
    }
    

    And there you have it all nice and fast.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so i have one really monstrous MySQL table (900k records, 180 MB total),
I have a document that I want to be flipped / rotated 180 degrees
I have list of IPs: 238.51.208.96/28 238.51.209.180-199 238.51.209.100-109 238.51.213.2-254 ... How can I easily
I have an array of part lengths, for examples sake:- array(150, 180, 270); I
i have a table with code like this: <tr> <th scope=row>5-17</th> <td>23.6 (22.0-24.0)</td> <td>18.0
Have deployed numerous report parts which reference the same view however one of them
I have code that displays a menu and 4 JButtons in a JFrame. I
I have the following extjs code that createa 2 tabs and a grid. How
I know I need an event filter for Qt 4 to handle keyboard events.
I have a game here, and I would like to add event handlers to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.