glennchristensen
Technical User
hey,
I have a script for an elastic button , but I need the button to be placed inside a MC - which is going to be part of a scrolling area.
I can get it to work if it becomes a graphic, but the "elastic" effect does not work when placed within a MC.?!
onClipEvent (load) {
k = 0.6;
damp = 0.6;
orgzx = _width;
orgzy = _height;
zx = _width;
zy = _height;
lower = _x-(_width*0.8);
higher = _x+(_width*0.8);
bottom = _y+(_height*0.8);
top = _y-(_height*0.8);
scale = 1.5;
}
onClipEvent (enterFrame) {
inside = (_root._xmouse>=lower) && (_root._xmouse<=higher);
outside = (_root._xmouse<lower) || (_root._xmouse>higher);
func = (_root._ymouse<top) || (_root._ymouse>bottom);
if (inside) {
zx = orgzx*scale;
zy = orgzy*scale;
}
if (outside) {
zx = orgzx;
zy = orgzy;
}
if (func) {
zx = orgzx;
zy = orgzy;
}
ax = (zx-_width)*k;
vx += ax;
vx *= damp;
_width += vx;
ay = (zy-_height)*k;
vy += ay;
vy *= damp;
_height += vy;
}
I have a script for an elastic button , but I need the button to be placed inside a MC - which is going to be part of a scrolling area.
I can get it to work if it becomes a graphic, but the "elastic" effect does not work when placed within a MC.?!
onClipEvent (load) {
k = 0.6;
damp = 0.6;
orgzx = _width;
orgzy = _height;
zx = _width;
zy = _height;
lower = _x-(_width*0.8);
higher = _x+(_width*0.8);
bottom = _y+(_height*0.8);
top = _y-(_height*0.8);
scale = 1.5;
}
onClipEvent (enterFrame) {
inside = (_root._xmouse>=lower) && (_root._xmouse<=higher);
outside = (_root._xmouse<lower) || (_root._xmouse>higher);
func = (_root._ymouse<top) || (_root._ymouse>bottom);
if (inside) {
zx = orgzx*scale;
zy = orgzy*scale;
}
if (outside) {
zx = orgzx;
zy = orgzy;
}
if (func) {
zx = orgzx;
zy = orgzy;
}
ax = (zx-_width)*k;
vx += ax;
vx *= damp;
_width += vx;
ay = (zy-_height)*k;
vy += ay;
vy *= damp;
_height += vy;
}