4 Replies Latest reply on Feb 17, 2008 8:49 PM by rlc5611

    Duplicate Movie Clip with Sequential Numbered Buttons

    fanmap81
      I would like to know how i can duplicate a button a set number of times that has a dynamic text field on top of it, and upon duplicating, have the text box show numbers in a sequential fashion. For example:

      box1=1, box2=2, box3=3, box4=4, etc.

      i also want to duplicate the boxes in a grid-like fashion.....for example 30 boxes, i would like them to display as such....

      01 02 03 04 05 06 07 08 09 10
      11 12 13 14 15 16 17 18 19 20
      21 21 22 23 24 25 26 27 28 29 30


      How exactly would i code something like this? and how can i put actions on each individual button? any and all help is appreciated. thanks
        • 1. Re: Duplicate Movie Clip with Sequential Numbered Buttons
          rlc5611 Level 1
          This is one way that might give you some ideas.
          • 2. Re: Duplicate Movie Clip with Sequential Numbered Buttons
            fanmap81 Level 1
            ok.....this is pretty good rlc5611, but i notice that your code designs the button movie clip.......what if i have my own designed button mc that has a dynamic text field already with an embedded font on it? The name of the movieclip button instance is BigButton. Thanks
            • 3. Re: Duplicate Movie Clip with Sequential Numbered Buttons
              rlc5611 Level 1
              I only scripted the button for convenience. You can use any method you like to create the buttons and the script is simpler. For example, if your button is in the library with the linkage identifier "bigButton", you can use attachMovie to create the instances. In the attached, I assumed your dynamic text field in the button has the instance name "mytext" but name it as you wish. Juts make sure your dynamic text field is not selectable or it will interfere with the button. If bigButton is on the stage already, use duplicateMovieClip instead of attachMovie.
              • 4. Re: Duplicate Movie Clip with Sequential Numbered Buttons
                rlc5611 Level 1
                Usually when you create sequential buttons, the rollover, rollout and release functions tend to be similar or symmetric so scripting these functions within the for loop can usually be done with no problem. But if your thirty sequential buttons will have very unique functions, you can script each button individually after the for loop has created them. Alternatively you can script the buttons within the for loop by passing the desired functions in an array. The attached script shows this although I only provided functions for 9 buttons due to laziness. I find this method of scripting the buttons a little more useful in that I can make a generic movie clip and use it for different tasks while modifying the functions in a higher level timeline.