XML Image Gallery with Star Style
| Category | : Flash | Views | : 69834 | ||
| Version | : 8 | Rating | : | ||
| Type | : Text | Source File | : xml-image-gallery-with-star-style.zip | ||
| Result | : See the result | ||||
variable to ease += (end variable – current variable) / speed
The bigger the speed is the slower the easing will be and vise-versa.We use this easing to get closer to the selected picture in every frame.
for (i = 0; i < _root.frames_array.length; i++)
{
_root.frames_array[i].Move();
}
}
Then we call the function Move() of every frame on the screen.
function moveFrames()
{
This is the code that runs when we call the Move() function of the MCs so "this" refers to the MC.
var nX = this.x - _root.curX
var nY = this.y - _root.curY
var nZ = this.z - _root.curZ
Here we get the difference between this MC and the "camera", these variable are going to be used as the new positions.
if (nZ < 0)
{
If the z coordinate is negative than the MC would be behind us and we wouldn't see it.So we get new values for the MC and it will appear far away from us.
this.z += 10000;
this.x = Math.random() * 2000 - 1000;
this.y = Math.random() * 1600 - 800;
These are new values for the coordinates.
nX = this.x - _root.curX
nY = this.y - _root.curY
nZ = this.z - _root.curZ
}
And calculate these again with the new values.
var ratio = 400/(400 + nZ);
Here we calculate the ration depending on the distance of the MC so that the scale, position, and alpha are proportional with the distance.For example: if nZ equals 0 the ratio would be 1, and as you can see 4 lines of code below the MC scale would be 100%.
400 is a number you need to get by testing, if you put a bigger number everything will look closer and a smaller number everything will look too far away. Find what is best for your needs, in my case 400 doesn't look too close or too far.
this._alpha = ratio * 1000
The alpha at the ratio of 1 is 1000, but translates to 100% as there isn't an alpha bigger than that. I used "1000" because even pictures that are pretty close would have low alpha.
this._x = nX * ratio;
this._y = nY * ratio;
Get a position for the MC that is proportional with its distance.
this._xscale = this._yscale = 100 * ratio;
Get the scale of the MC that is also proportional with the distance.
this.swapDepths(Math.round(-nZ));
}
Swap depths to make MCs that are closer to stay above the one that are further.
![]() |
![]() |
![]() |
![]() |
![]() |







