[Code Snippet] Tombalachi's Hiding Menu Script Revised
Sunday, May 27, 2007 by SirSmiley | Discussion: DesktopX
- '--Note the With Statement is only used where the savings are obvious
- '----------CUSTOMIZE HERE----------
- Const hideTop = -160,hideLeft = -160,hideSpeed = 10,hideDelay = 700,_
- showTop = -50,showLeft = 0,showSpeed = 16
- '-----------END CUSTOMIZE----------
- Dim delay
- 'Called when the script is executed
- Sub Object_OnScriptEnter
- delay = 0
- 'Timer for hiding the object
- Object.SetTimer 4321, 100
- End Sub
- 'Called when the script is terminated
- Sub Object_OnScriptExit
- Object.KillTimer 4321
- Object.KillTimer 1234
- End Sub
- Sub Object_OnStateChange(state)
- With Object
- If state = "Mouse over" Then
- 'Kill the hide timer
- .KillTimer 4321
- 'Start the show timer
- .SetTimer 1234, 100
- Else
- 'Kill the show timer
- .KillTimer 1234
- 'Start the kill timer
- .SetTimer 4321, 100
- End If
- End With
- End Sub
- Sub Object_OnTimer1234
- 'Show the object
- Call MoveIt(showTop, showLeft, showSpeed)
- If (Object.Top = showTop) And (Object.Left = showLeft) Then
- delay = hideDelay
- End If
- End Sub
- Sub Object_OnTimer4321
- 'Hide the object
- If delay <> 0 Then
- 'We wait until delay is over
- delay = delay - 100
- Else
- Call MoveIt(hideTop, hideLeft, hideSpeed)
- End If
- End Sub
- Sub MoveIt(destTop, destLeft, speed)
- With Object
- 'Are we there yet?
- If (.Top <> destTop) Or (.Left <> destLeft) Then
- 'Go ahead and hide
- Dim diffTop,diffLeft,distance,speedTop,speedLeft
- diffTop = destTop - .Top
- diffLeft = destLeft - .Left
- distance = (diffTop^2 + diffLeft^2)^0.5
- speedTop = speed * diffTop / distance
- speedLeft = speed * diffLeft / distance
- If Abs(speedTop) > Abs(diffTop) Then
- speedTop = diffTop
- End If
- If Abs(speedLeft) > Abs(diffLeft) Then
- speedLeft = diffLeft
- End If
- .Move .Left + speedLeft, .Top + speedTop
- End If
- End With
- End Sub
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!






