The elasticity is really hard to do. I tried it for one afternoon and didn't make it out:
// Total number of images:
Total = 7;
// Spacing:
D = 25;
// Image width:
W = 100;
// Total length:
W = total * (w + d );
// The speed at which the image gets bigger and smaller:
DScale = 10;
// Add images to the scene:
For (I = 1; I <= total; I ++ ){
This. attachMovie ("pic", "pic" + I, I, {_ x: I * (w + d)-W/2 });
Pic = this ["pic" + I];
Pic. gotoAndStop (I );
// Place the cursor over the image:
Pic. Onrolover = function (){
This. onEnterFrame = function (){
// Increase:
This. _ xscale = this. _ yscale + = dScale;
// Adjust the distance based on the image:
Pic0 = this;
Distance (pic0 );
// If it reaches a certain level, it will stop increasing:
If (this. _ xscale> 200 ){
This. _ xscale = this. _ yscale = 200;
Delete this. onEnterFrame;
Pic0 = head;
}
};
};
// Move the mouse away from the image:
Pic. Onrolout = function (){
This. onEnterFrame = function (){
// Decrease:
This. _ xscale = this. _ yscale-= dScale;
// Adjust the distance based on the image:
Pic0 = this;
Distance (pic0 );
// If it is small to a certain extent, it will stop becoming smaller:
If (this. _ xscale <100 ){
This. _ xscale = this. _ yscale = 100;
Delete this. onEnterFrame;
Pic0 = head;
}
};
};
// Create something similar to a two-way linked list:
Pic. prevPic = prevPic;
PrevPic. nextPic = pic;
PrevPic = pic;
}
// Forming a link chain:
This. pic1.prevPic = this ["pic" + total];
This ["pic" + total]. nextPic = this. pic1;
//
Head = this. pic1;
Tail = this ["pic" + total];
// Use the chain header as the benchmark (used to adjust the distance ):
Pic0 = head;
//
Function onEnterFrame (){
If (head. _ x <-W/2 ){
Head. _ x = tail. _ x + (tail. _ width + head. _ width)/2 + d;
Tail = head;
Head = head. nextPic;
Pic0 = head;
} Else if (tail. _ x> W/2 ){
Tail. _ x = head. _ x-(tail. _ width + head. _ width)/2-d;
Head = tail;
Tail = tail. prevPic;
Pic0 = head;
}
Head. _ x + =-_ xmouse/20;
Distance (pic0 );
}
// Configure //--------------------------------------------------------------------------------------------
// Use pic0 as the benchmark to adjust the distance between Pictures:
Function distance (pic0 ){
Var pic = pic0;
While (pic! = Head ){
Pic. prevPic. _ x = pic. _ x-(pic. _ width + pic. prevPic. _ width)/2-d;
Pic = pic. prevPic;
}
Pic = pic0;
While (pic! = Tail ){
Pic. nextPic. _ x = pic. _ x + (pic. _ width + pic. nextPic. _ width)/2 + d;
Pic = pic. nextPic;
}
}