# Flash MX 2004...problem with an elastic effect code

Hi I am trying to change the code to this effect , it’s an elastic effect(photogallery) with masking and i have movie clips inside the library linked with the code and all i would like to do is to just do a vertical up and down effect (with 2 bottons) kind of like prev and next (left and right) that i alreadt have in this code but i am a beginner in AS and i can’t figiure it out…here’s the code:
import mx.transitions.Tween;
import mx.transitions.easing.;
var w=800
var h=600
num = 5
function drawSquare(clip, depth, colour, x, y, w, h) {
var mc = clip.createEmptyMovieClip(“clip”+depth, depth);
mc._x = x;
mc._y = y;
mc.lineStyle(0);
mc.beginFill(colour);
mc.lineTo(w, 0);
mc.lineTo(w, h);
mc.lineTo(0, h);
mc.endFill();
return mc;
}
function drawTriangle(clip, depth, colour, x, y, w, h) {
var mc = clip.createEmptyMovieClip(“clip”+depth, depth);
mc._x = x;
mc._y = y;
mc.lineStyle(0);
mc.beginFill(colour);
mc.lineTo(w, 0);
mc.lineTo(w/2, h);
mc.endFill();
return mc;
}
cliparray = [];
current = 1;
currentv=0
this.createEmptyMovieClip(“holder”, 1);
holder._y =0
holder.startx = holder._x=-600
for (var i = 0; i<num; i++) {
var hh = holder.createEmptyMovieClip(“h”+i, i);
hh.attachMovie(“p”+i, “p”, 1);
var t = hh.attachMovie(“t”+i, “t”, 2);
t._y = h;
//add more here but increae jvar by 1 for each + _y =2
h,_y =3h increase each time
hh.jvar = 1
hh._x = i
w;
hh.starty = hh._y;
hh.ivar = i;
hh.up = false;
cliparray.push(hh);
hh.endy = h-hh._height;
}
holder.endx =w+600-holder._width;
function tweener(tx) {
var s = new Tween(holder, “_x”, Elastic.easeOut, holder._x, tx, 2, true);
s.onMotionFinished = function() {
disableall(true);
};
}
function vertmove(ty,target,callback) {
onEnterFrame = function () {
target._y += (ty-target._y)/3;
if (Math.abs(ty-target._y)<2) {
target._y = ty;
delete this.onEnterFrame
callback()
}
};
}
function moveleft(){
if(w-currentw -600>holder.endx){
currentv = 0
current++;
tweener(w-current
w-600);
}
}
function moveright(){
if(w-currentw-600<holder.startx+600){
currentv = 0
current–;
tweener(w-current
w-600);
}
}
function leftF() {
vertmove(0,cliparray[current],moveleft)

}
function rightF() {
vertmove(0,cliparray[current],moveright)
}
function upF() {
if(currentv<cliparray[current].jvar){
currentv++
vertmove(-h*currentv,cliparray[current])
}

}
function downF() {
currentv=0
vertmove(-h*currentv,cliparray[current])
}

left.onPress = leftF;
right.onPress = rightF;
up.onPress = upF;
down.onPress = downF;
function disableall(t) {
left.enabled = t;
right.enabled = t;
up.enabled = t;
down.enabled = t;
}
up.swapDepths(10000)
down.swapDepths(10001)
left.swapDepths(10002)
right.swapDepths(10003)