I’m working on a personal project and I want to use this type of effect on the content. I want the finished product to have one “zoom()” function defined that will be able to be used on whichever “content” clip that is clicked on. Does that make sense?
Here’s the code I have that I want to “globalize” to reuse on 9 different “content” clips.
//ATTACHED TO BUTTON MOVIE CLIP
onClipEvent (load) {
_x = 50;
_y = 50;
_width = 25;
_height = 25;
_rotation = 50;
_alpha = 0;
speed = 2.5;
var endX;
var endY;
var endW;
var endH;
var endR;
i = 0;
function zoom() {
if (i == 0) {
endX = 442.5;
endY = 442.5;
endW = 15;
endH = 15;
endR = 0;
_root.square_mc.cEndX = 300;
_root.square_mc.cEndY = 300;
_root.square_mc.cEndW = 300;
_root.square_mc.cEndH = 300;
_root.square_mc.cEndR = 0;
i++;
} else {
endX = 50;
endY = 50;
endW = 25;
endH = 25;
endR = 50;
_root.square_mc.cEndX = 50;
_root.square_mc.cEndY = 50;
_root.square_mc.cEndW = 25;
_root.square_mc.cEndH = 25;
_root.square_mc.cEndR = 50;
i--;
}
}
}
onClipEvent (enterFrame) {
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
_width += (endW-_width)/speed;
_height += (endH-_height)/speed;
_rotation += (endR-_rotation)/speed;
}
onClipEvent (load) {
this.onRelease = function() {
zoom();
};
}
//ATTACHED TO CONTENT MOVIE CLIP
onClipEvent (load) {
_x = 50;
_y = 50;
_width = 25;
_height = 25;
_rotation = 50;
speed = 2.5;
var cEndX;
var cEndY;
var cEndW;
var cEndH;
var cEndR;
}
onClipEvent (enterFrame) {
_x += (cEndX-_x)/speed;
_y += (cEndY-_y)/speed;
_width += (cEndW-_width)/speed;
_height += (cEndH-_height)/speed;
_rotation += (cEndR-_rotation)/speed;
}
Here’s my .fla so you can see what I’m talking about.
Oh yeah, I forgot to mention that I am going to be loading external SWFs for all nine content panels… if that makes a difference in the coding. Thanks in advance for any help!