I want to make a mouse follow Effect with Flash mx 2004, such that when the mouse come over the links the Image as the banner will move to the other direct, i want to do that without using Actionscript.
Take a look at www.craigdavid.co.uk and see the Effect. I need help as fast as possible.
That effect was done using ActionScript for sure. It would take ages to tween an effect like that. This is how it works:
All the images are placed next to eachother and brought together in one movieclip. A mask is being placed over that movieclip so you can only see the part in the middle. When you roll over the buttons, ActionScript is used to make that movieclip ease to a given x position. Here is a prototype you can use to make the movieclip ease to a certain x position:
MovieClip.prototype.easeX = function(x){
this.onEnterFrame = function(){
this._x = x-(x-this._x)/1.2
if(this._x > x-1 && this._x < x+1){
delete this.onEnterFrame;
}
}
}
//Usage:
yourmovieclip.easeX(500)
//this will make yourmovieclip ease to the x position of 500.
Here’s what you would use on the buttons:
on(release){
imagesmovieclip.easeX(326);
}
326 is just an example position. These are of course different for each button.
If you also want a mouse follower, there’s a great tutorial here on www.kirupa.com
I got answer right the but where do i insert the first code ?
ActionScript:--------------------------------------------------------------------------------MovieClip.prototype.easeX = function(x){
this.onEnterFrame = function(){
this._x = x-(x-this._x)/1.2
if(this._x > x-1 && this._x < x+1){
delete this.onEnterFrame;
}
}
}
//Usage:
yourmovieclip.easeX(500)
//this will make yourmovieclip ease to the x position of 500.
And the movie, does it need Frames (how many) or how many layers does it require.
The prototype code can be placed anywhere in your movie, but it is preferably placed on the first frame of your main movie. That way the function is available to all movieclips from the first frame on.
I can’t tell exactly you where you need to place your button code - that depends on your file structure. If you are going to use the dynamic event handler (yourbutton.onRelease = function() {…), then it should be placed on the frame which your buttons are in.
If you are using the static on(release) handler, the code should be placed onto your buttons.
Always remember to alter paths !
And the movie, does it need Frames (how many) or how many layers does it require.
A movie doesn’t “require” a certain amount of layers or frames. You use the movie’s frames for animating, the movie doesn’t require you to use a specific amount. Same goes for layers. They are just there to make working with timelines and objects easier.
Why did you make a poll on this ? Quite unnecesary.
Goes on the first frame of your main timeline. This code makes the ease function available to every movieclip. That’s why it’s placed at the beginning of the movie, so that every movie has access to it from the first frame on.
The second part depends on if you want to use static event handlers (on(release), goes on the button itself) or dynamic event handlers (yourButton.onRelease = function(){…, goes on the timeline your buttons are in). I suggest you use dynamic event handlers here. Then this code goes on the timeline your buttons are in: