XML Image Gallery with Star Style

Category : Flash Views : 23074
Version : 8 Rating
3.7/5 (44 votes)
Type : Text Source File: xml-image-gallery-with-star-style.zip
Result: See the result


Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Next

mc.onPress = _root.selectFrame
Set the onPress event from the MC to call the function "selectFrame", which we will create.

mc.Move = _root.moveFrames
Create a function called "Move" inside the MC and that function will be the same as the function "moveFrames" that we will code.

_root.frames_array[_root.frames] = mc
Populate the array with the MCs we create.

_root.frames++ }
Increase this variable.

target.removeMovieClip(); }
Remove the MC we used to load the image as it is useless now.

Now let's code the frames to move:
this.createEmptyMovieClip("framesMC", 1);
Create a new MC; this MC is where we are going to create the others.

framesMC._x = Stage.width/2; framesMC._y = Stage.height/2;
Set the position to the middle of the stage so that the created MC will come from the middle.

//current x, y and z position that we are looking at. //This on this variable like the coordinates of //a "camera" that is moving towards an MC var curX = 0; var curY = 0; var curZ = 0;
These variables represent where we are looking at in the stage. You need to think like these are the coordinates of a camera that is showing us the pictures and we need to change these variables to move the camera.

//selected x, y and z position that we want to //go to. Or where we are moving the "camera" to. var selX = 0; var selY = 0; var selZ = 0;
And these variables are where we want to go.

function selectFrame() { _root.selX = this.x _root.selY = this.y _root.selZ = this.z }
This code runs when a MC is clicked, we set these variables to the coordinates of the MC that was clicked.

framesMC.onEnterFrame = function() { _root.curX += (_root.selX - _root.curX)/5; _root.curY += (_root.selY - _root.curY)/5; _root.curZ += (_root.selZ - _root.curZ)/5;
This is an easing calculation that is very useful in almost anything.


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Next




Supporters

Reseller Web Hosting