2 Replies Latest reply on Feb 11, 2008 11:52 AM by Mr. Aztek

    Arrays are my friends, right?

    Mr. Aztek
      Okay, I've used arrays in the past, but I'm still very leery of screwing things up. The code below is my usual long-way-around the barn approach. I know that putting the buttons in an array is a first step, but then how to get it to advance to the next numeric frame is where I get nervous (every button points to a frame starting on two, so button two points to frame 3, and so on). I know I can use keyframes/labels but I don't want to have to repeat the AS for each new keyframe on my AS layer. Any help would be appreciated. Thanks!
        • 1. Re: Arrays are my friends, right?
          clbeech Level 3
          hey Mr.A! :) ok let see what we have here ... you just want the button to advance one frame from it's 'number'. Guess I'm wondering why you don't have them numbered in relation to the frame, that would make it a little easier, ... but anywho lol!! doesn't matter :) yes, put them in an array, then use a loop to assign the handlers and the frame number using the loop index, but we have to something a little 'tricky' here, because of the nature of the incremented var in the loop, we need to store a reference of the number at that point in the iteration. so to do so, I've assigned a new property to the 'button' instance called 'frame' then you'd use that property value as the correct frame number, I also add 2 to the number of the increment to find the correct frame number, because the array index begins at zero and the button's number sequence begins at 1. that should do it!

          • 2. Re: Arrays are my friends, right?
            Mr. Aztek Level 1
            HA!

            Yeah, I know it's weird, but the buttons are all set up on frame 1, and they lead to the frames that follow it on the timeline, none of which contain the buttons (it's like a "click here to see the answer/example" kind of thing). I'll definitely give it a shot tomorrow—leaving for the rest of the day—and will let you know how it pans out. Thanks again!