OK, I posted that in the wrong forum… Waz late and I messed up… Mederator: feel free to delete the duplicate post in “Flash MX” thread. THX! Here it is:
ok, that’s some basic question but it’s 4 am, I can’t find the answer in the tutz and I’m starting to get a headache…
I’m creating some mc’s on the stage with the attachMovie function in a loop. I have no problem naming them like that:
foo.attachMovie(“myClip”, “myClip”+i, 200+i);
But I need to name them with part of an array like that:
hi sbeener! nice to “see” you
I finally have a few days off to work on the same project you already helped me with… I’m adding some animation to those buttons created from the arrays… So I wanted to name the attached clips with the array elements names being part of their instance names instead of just button1, button2, etc… I couldn’t figure it out, so I kept the “myClip”+i format and I did something really not elegant to get the animation to work like that:
I’m sure you’d do the same with a nice looking prototype but I can’t really get the hang of those yet… And I don’t have time to practice, I wanna get this site done The animation has some kinda arrow looking thing, hence the name of the variables…
Now, I’m contemplating how to fade out the old buttons instead of using the removeMovieClip thing… But I have no idea how yet Ho well… No sleep for me again tonight!
MovieClip.prototype.subCat_BTcreate = function(subCat_array) {
var i, m;
for (i in _root.oldButtons) {
removeMovieClip(_root.oldButtons*);
}
for (i=0; i<subCat_array.length; i++) {
m = this.attachMovie(“subCat_BT”, “subCat_BT”+i, 100+i);
_root.oldButtons.push(m);
m._x = _root.marker2_mc._x-m._width-2;
m._y = 358-(m._height*(i+1));
m._alpha = 1;
m.addText(subCat_array*);
the for in is still kinda mysterious to me, and I tried to understad the .push thing but I thought it was for arrays andt you use it on the variable m
If you have time to explain, I’d love to learn faster than usual (meaning on my own thx.
push means add an item to the end of an array. that command is pushing m onto _root.oldButtons.
the idea is to create an array which contains a reference to each button you create. then when you need to clear them, just run removeMovieClip on everything in the array.
that onEnterFrame event… you want all of the buttons to be running that so that their arrows will animate when they’re selected? what’s the code that sets _root.subCatArrow?