Movable XML Image Gallery
| Category | : Flash | Views | : 29620 | ||
| Version | : 8 | Rating | : | ||
| Type | : Text | Source File | : movable-xml-image-gallery.zip | ||
| Result | : See the result | ||||
rot = (Math.random() * 90) – 45
Set the variable "rot" to a random rotation between -45 and 45.
xSpeed = Math.random() * 5 + 2
ySpeed = Math.random() * 5 + 2
Random _x and _y speed.
rotSpeed = Math.random() * 5 + 2
Get a random speed for the rotation.
loaded = false;
}
Variable used to know whether the image is loaded or not.
onClipEvent(enterFrame)
{
if(!loaded)
{
If the image is not loaded move the Movie Clip to the destination.
this._y += (destY - this._y) / ySpeed;
this._x += (destX - this._x) / xSpeed;
Move the code using this easing math:(destination - current position) / speed;
The smaller the speed the faster the Movie Clip will move and vise-versa.
this._rotation += (rot - this._rotation)/rotSpeed;
}
Rotate Movie Clip with easing.
if(this.Pic.percentLoaded != 100)
{
this.percent.text = this.Pic.percentLoaded;
}
If the image is not 100% loaded set the text of the textbox to the current percentage.
else
{
this.percent._visible = false;
loaded = true;
}
}
If the image is loaded hide the textbox by setting the visibility to false and set loaded to true.
onClipEvent(mouseDown)
{
this.oldMousex = _root._xmouse;
this.oldMousey = _root._ymouse;
Set the old position to the current position of the mouse.
this.mDown = true;
Mouse is down so set to true.
if(this.hitTest(_root._xmouse, _root._ymouse, true))
{
this.startDrag();
this.swapDepths(_root.getNextHighestDepth());
}
}
If the mouse clicked on this Movie Clip use the function startDrag() to automatically make the mouse drag the Movie Clip and use swapDepths(depth) to get this frame on the top of the others.
![]() |
![]() |
![]() |
![]() |
![]() |




