I am currently building a (mock up) to view subscriber information by duplicating a movie clip based on an array. I'm grabbing the data from an xml and trying to pass the array to duplicated clips. The problem I'm running into is that I can only get data to the first duplicated movie and the original remains blank.
Fantastic!.....except it only works for one duplicated move. The xml will be dynamically updated with nodes so there may be as many as four or five movies I need to duplicate. Add this to the existing xml tree and you will see what I mean:
Oh, the problem is that it only calculates the first mc's height all the time, making all the duplicates stay in the same position, and I didn't realize that until now
You're probably wondering how that worked. Well, since (i-1) calculated the position of the previous added movieclip and added 15 to it, it actually didn't work for the first duplicated movieclip, because if the first one is named info_mc0, then there's no mc with the instance name, info_mc-1, hence the first duplicated movieclip's Y position becomes NaN or undefined and is positioned on the original movieclip's Y position, and then the next duplicated movieclip is offset from the first duplicate movieclip's position and so are the rest as well. To solve this, I declared 2 variables in the beginning to store the original mc's Height and Y position, and then in the for loop checked if variable i in the for loop is equals to 0, and if it is, it means that it's the first loop in the whole for loop, and then I set the first duplicated movieclip's Y position equals to the original one which I saved in a variable. For the rest of the duplicated movieclips after the first one, I set their Y position equals to the previous duplicated movieclip's Height+15 multiplied with variable i's value, so let's say the height of the movieclip is 80, which is the space you want between each movieclip, then for the second duplicated movieclip, its Y position becomes 80*1, for the next one, 80*2, 80*3, and so on, we could actually just drop (item_mc["info_mc"+(i-1)]._height+15) and replace it with mcHeight variable's value, since all of the duplicated movieclips heights are the same
Hope this helps, despite the messy explanation xD
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
So now that I have the clips duplicated, how would I access individual instances of buttons within each clip?
So if I have a button called "edit_btn" in each duplicate. I can access the object path with an onRelease (in the 'for' loop) using a trace which returns:
I'm able to get the object path returned (via trace) but the problem I have is how do I convert it to a string or variable?
What I initially thought was I could grab the mc number (["mc"+i]) via the object path and use "charAt" to get the individual number...but converting the object path to a string isn't working.