Hi, I’ve got a row of boxes (named box01, box 02 etc) in AS3
I’m trying to get it so that when you rollover one of the boxes, it scales up using tweenmax, and all the boxes to the right of the current box shift along by about 80 pixels and any boxes to the left stay where they are, and on roll out the box tweens back to normal size and the boxes to the right tween back to their original positions
here’s what i’ve got so far:
//imports
import com.greensock.TweenMax;
import com.greensock.easing.*
var boxes:Array = [box01, box02, box03, box04, box05, box06];
var shifters:Array = [box02, box03, box04, box05, box06];
box02.leftMC = box01;
box03.leftMC = box02;
box04.leftMC = box03;
box05.leftMC = box04;
box06.leftMC = box05;
box02.leftMC.currentX = box01.x;
box03.leftMC.currentX = box02.x;
box04.leftMC.currentX = box03.x;
box05.leftMC.currentX = box04.x;
box06.leftMC.currentX = box05.x;
function shifter(e:Event) {
if(e.currentTarget.leftMC.scaleX == 2){
TweenMax.to(e.currentTarget, .5, {x:"+20", ease:Back.easeIn});
} if(e.currentTarget.leftMC.x>e.currentTarget.leftMC.currentX){
TweenMax.to(e.currentTarget, .5, {x:"+20", ease:Back.easeIn});
}
}
for (var i=0;i<boxes.length;i++) {
var tmp01:MovieClip = boxes* ;
tmp01.buttonMode = true;
tmp01.addEventListener(MouseEvent.MOUSE_OVER, boxrollOver);
tmp01.addEventListener(MouseEvent.MOUSE_OUT, boxrollOut);
}
for (var ii=0;ii<shifters.length;ii++) {
var tmp02:MovieClip = shifters[ii] ;
tmp02.addEventListener(Event.ENTER_FRAME, shifter);
}
function boxrollOver(e:MouseEvent) {
TweenMax.to(e.currentTarget, .5, {scaleX:2, scaleY:2, ease:Elastic.easeOut});
}
function boxrollOut(e:MouseEvent) {
TweenMax.to(e.currentTarget, .5, {scaleX:1, scaleY:2, ease:Elastic.easeOut});
}
sorry if the code’s messy, i’m quite new to actionscript to be honest
its not really doing what i want at all, not sure what i can do :
any help would be excellent or even any links to tutorials anyone’s seen, however i couldnt seem to find any
Thanks