PDA

View Full Version : script animation-return to starting point on rollover?


Gostop01
10-24-2002, 04:16 AM
www.triple5soul.com (http://www.triple5soul.com)

Hello,
I am trying to recreate the menu on triple5soul.com.

go to the website. roll over the left side menu bar and then roll off. Note that they start a scripted animation of the buttons where at any point when rolled over they return to the starting point.

If anyone knows a simular tutorial or can post a similar file it would be a great help. Or if you can just point me in the right direction...

anything is apreciated.
thanks.
-trevor

Esquared
10-24-2002, 08:25 AM
Contain the entire menu within a single movie clip. Place a background on one layer of this mc to serve as the hit area for the menu. Arrage all elements within the mc so that its origin is at the top, and place it at the top of the stage. Within the menu MC, place the menu items, each a mc as well.

On each menu item mc:

onClipEvent(load)
{
this.startY = this._y
returnSpeed = Math.random(); //any value from 0 - 1
driftSpeed = random(10)+1; //any value from 1 - 10
}
onClipEvent(enterFrame)
{
if(_parent.hitTest(_root._xmouse, _root._ymouse, true))
{
this._y -= (this._y - this.startY)*returnSpeed;
} else {
this._y += driftSpeed;
if(this._y > 500) // the stage height + the menu item mc height
{
this._y = -50 // - menu item mc height
}
}
//place a button in the mcs or use if(this.hitTest(...)) to create rollovers/actions
}


That should do it!