Hey, trying to create a zipper effect using this guy's tutorial.
Mind you of course, that was done in SwishMax which I've never used before, but the language seems to work basically the same.. or is it the same?
Anyway, I'm having a little trouble getting it to work, I've never gotten into mathematical functions before. All movieclips in my swf are on the main timeline, and all of the code is on the first frame of the main timeline. I have a zipper tab movieclip named "tab", and zipper teeth mc's; left ones are named l1 through l46, right teeth are named r1 through r46.. just as in the mentioned tutorial.
Here's my code:
//declared variables
var pressed:Boolean = false;
var distance:Number = 0;
var curve:Number;
//drag function
tab.onPress = function() {
pressed = true;
tab.startDrag(false, tab._x, 0, tab._x, 570);
}
tab.onRelease = function() {
pressed = false;
tab.stopDrag();
}
//teeth separation function
onEnterFrame = function() {
distance = tab._y;
for (i=1; i<=46; i++) {
curve = math.exp(i/3*0.9+.5);
["l"+i]_x = -3-(distance/curve);
["r"+i]_x = 3+(distance/curve);
}
}
Resulting swf has a functioning zipper tab which drags as expected, but teeth remain in place. The "curve" variable remains undefined. Any ideas?