3 Replies Latest reply on Feb 11, 2008 12:03 PM by clbeech

    Grouping objects

      Hi, i was wondering if there was a way in flash to group a set of objects, e.g a load of buttons, so that you can apply a single AS function to control them, rather than having to create a separate function for each button.

      ill give you an example, i want to apply the same tween to 5 different buttons, but i don't want to write

      button1... = function
      button2... = function

      i would just like to go

      group_of_buttons... = function

      Thanks for your help
        • 1. Re: Grouping objects
          robdillon Most Valuable Participant
          Create an array and put the instance names of each of the buttons into that array. Loop through the array and assign a function to each event for the items in that array. Write the actual function.
          • 2. Re: Grouping objects
            Hi,

            I tried that, it didn't really work with what i was trying to do, maybe its my coding, I'm not sure. All the buttons are not responding the way they should. Please have a look.

            Thanks
            • 3. Re: Grouping objects
              clbeech Level 3
              this is because you're not assigning the methods return value here, you're assigning the action of the method to the handler while passing a reference to the instance, so you need to change the syntax to:

              1 person found this helpful