-
Enter the Flash Dragon
How to do this??
How can I make the link buttons like on this site: http://www.greyscale.net
You see how the buttons are all moving around a stuff. Can someone help me out on this.
Any advice, code examples or tutorial would sure be appreciated!
-
To get the random movement of a point (or any movieclip) you need to use a random number generator to increment the x and y positions. Check out the following code (attach to a movieclip):
onClipEvent (enterframe) {
this.yRand = 2 - Math.random()4;
this.xRand = 2 - Math.random()4;
this._y += this.yRand;
this._x += this.xRand;
}
Note: yRand and xRand will be between -2 and 2 which will ensure that the movieclip may move in any direction.
To get the rollover expanding effect you'd need to add a hitest or rollover operation and a bunch more actionscript with quite a few if statemnets. I don't have time to go into it now, but I may be able to get back to you later if you still need help.
Rock on!
Shane
-
Enter the Flash Dragon
Thanks Shane for the reply and the code.
One question, do I put the button inside the movieclip?
-
No need for a button inside the movieclip because you can just use the movieclip itself as the button. I've figured out the full code for you - just copy the code below and with your movieclip selected, paste the code in the actions panel. You may want to play with some of the values to get the exact effect that you want, but this is pretty darn close. ENJOY!
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (this._xscale<400) {
this._xscale += 10;
this._yscale += 10;
}
} else {
if (this._xscale>100) {
this._xscale -= 10;
this._yscale -= 10;
}
yRand = 2 - Math.random()*4;
xRand = 2 - Math.random()*4;
this._y += this.yRand;
this._x += this.xRand;
}
}
on (release) {
//enter whatever action you want
}
-
Enter the Flash Dragon
Cool... thanks Shane, I try it out and get back to you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|