kglad,
Thanks for taking a look. In answer to your question. The movie clip
instance names are mc_ItemText0 ... mc_ItemText3.
[Q]those declarations at the top of your for-loop aren't doing anything
useful. what are the names of you movieclips that are on-stage?[/Q]
In reg\ards to the variable declarations, sorry my variable names are causing
confusion. I use the name "mc" for two different variables. Once for the FOR
loop and a separate time locally in the functions grow and shrink. The ones
set for the For loop are used in the 'onEvents' at the bottom of the script.
Sorry for the confusion.
Because the code works if I take it out of the FOR loop and replace the [i]'s
with the numbers that corruspond to the movie clip; I don't think the similar
names are conflicting because of the scope. To make the code more readable and
eliminate confusion I have posted the code with unique variable names.
I have searched the forum for FOR loop difficulties and found several cases
that seemed similar to mine, but I didn't understand what was happening.
Examples:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=28 8&threadid=1253110&highlight_key=y&keyword1=for%20loop
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=28 8&threadid=1202338&highlight_key=y&keyword1=for%20loop
My code with unique variable names to end confusion:
for(var i=0; i<4; i++) {
trace(i)
var mc_ItemText[i]:MovieClip;
var inter[i]:Number;
var mc[i]:MovieClip = mc_ItemText[i]
//functions
grow = function(mcLocal:MovieClip):Void {
if (mcLocal._width<=55) {
mcLocal._width += 1;
mcLocal._height += 1;
} else {
clearInterval(int1);
}
}
shrink = function(mcLocal:MovieClip):Void {
if (mcLocal._width>=45) {
mcLocal._width -= 1;
mcLocal._height -= 1;
} else {
clearInterval(int1);
}
}
//events
mc[i].onRollOver = function():Void {
clearInterval(int1);
int1 = setInterval(grow,10,mc[i]);
}
mc[i].onRollOut = function():Void {
clearInterval(int1);
int1 = setInterval(shrink,10,mc[i]);
}
}