Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object follow only on hotspot area

Status
Not open for further replies.

DondeSk

Programmer
Mar 27, 2006
22
AG
Oh my. Can't believe something I see all the time on websites could be so troublesome to replicate. Either that, or I'm just terrible with flash. The latter. :)

Anyhow, I'm still trying to create this:


So far the hover pop was accomplished. Now I need the text to follow the cursor, but only when it's assigned shape layer is hovered upon. When I do the 'object follow' in AS, the text follows, but since the script runs as soon as the frame starts the text basically follows anywhere on the stage. I only want the text to follow as long as it's over the hover/ hot spot area.

I tried bellow but the on (rollOver) appears wrong as the text doesn't follow anymore. Removing it just makes the text follow out of the hot spot area like I mentioned above.

on (rollOver){
peyton_mc.onEnterFrame = function() {
var xMouse = _root._xmouse;
var yMouse = _root._ymouse;
if(Math.abs(xMouse - this._x) < 1) {
this._x = xMouse;
this._y = yMouse;
} else {
this._x -= (this._x-xMouse) / 10;
this._y -= (this._y-yMouse) / 10;
}
}
}

It's amazing how many tutorials you'll find on how to make an object follow, but now many about setting boundaries for this object. Any help offered will be greatly appreciated.

Thanks
 
Hey thanks guys. I figured it out by using function to find out the location of the cursor and restricting objects to move out of it's set boundaries/coordinates!

Thanks for any thoughts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top