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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use cursor position to trigger action?

Status
Not open for further replies.

worldly1

Technical User
Mar 20, 2007
36
US
Hello All,

I’m fairly new to Flash 8 (Pro) and have used only very basic actionscript.

I have made a navigation menu bar with fly-out sub-menus and have everything working correctly. Now I want to put an animated gradient background movie clip behind the menu and set it up so that when the cursor is over/within the boundary of the gradient clip it will trigger it to gotoandplay x frame, and when the cursor leaves the area, trigger another gotoandplay event.

It seems I can’t set it up with onrollover and onrollout actionscript because of the menu that sits above it, so it seems I need some way or work around to know when the cursor enters and leaves an area or set of coordinates (or in this case is above a certain y coordinate) and trigger.

I found this site
which I thought might have the answer but I’m not advanced enough to follow it.

Any advice or direction will be much appreciated.

Scott
 
Thanks for responding! I posted this question on another forum and a kind soul hacked out this code for me:

onClipEvent(load){
ovr = 0
}
onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse, _root._ymouse, true))if(ovr == 0){
gotoAndPlay(2)
ovr = 1
}
if(!this.hitTest(_root._xmouse, _root._ymouse, true))if(ovr == 1){
this.gotoAndPlay(11)
ovr = 0
}
}

I don't fully understand why, yet, but it works like a charm!

Thanks, Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top