The Oddest Thing....

MouseOver interaction with Volume

Tuesday, August 8, 2006 by Cyberium | Discussion: DesktopX

Ok So I'm making an MP3 controller in DesktopX.. I decide to use MouseOver interaction for the Volume control (MouseOver "+" Volume goes up, MouseOver "-" Volume goes down).. And this is what happened and I swear I'm not making this up.. When I set the Volume to go up by 1 each time it only gets to 16% Volume (If I use another method to turn up the volume and try again it goes to 36% and so forth), but it work fines if I'm taking 1 each time.. Here's the code:

:: This is for the "-" control
Sub Object_OnMouseEnter
Object.SetTimer 1, 1
End Sub

Sub Object_OnTimer1
If System.Volume <= 0 Then
System.Volume = 0
Object.KillTimer 1
Else
System.Volume = System.Volume - 1
End If
End Sub

Sub Object_OnMouseLeave
Object.KillTimer 1
End Sub

:: This is for the "+" Control
Sub Object_OnMouseEnter
Object.SetTimer 1, 1
End Sub

Sub Object_OnTimer1
If System.Volume => 100 Then
System.Volume = 100
Object.KillTimer 1
Else
System.Volume = System.Volume + 1
End If
End Sub

Sub Object_OnMouseLeave
Object.KillTimer 1
End Sub

It works fine having "+ 2" instead though!.. Any answers are welcome
HaemOGObliN
Reply #1 Wednesday, August 9, 2006 7:58 AM
Hey Cyberium,

hope your well ...

I'm no pro at scripting ... but I figure this should work ...

EG: for the "+" Control :

-------------------------------------

Sub Object_OnMouseEnter
Object.SetTimer 1, 1
End Sub

Sub Object_OnMouseLeave
Object.KillTimer 1
End Sub

Sub Object_OnTimer1
If System.Volume < 100 Then
System.Volume = System.Volume + 1
Else
Object.KillTimer 1
End If
End Sub

-------------------------------------

It 'should' work, but I just tried it and got the exact same problem you did.

Hell knows ...

Let us know if u get it right ...

Good Luck !!
HaemOGObliN
Reply #2 Wednesday, August 9, 2006 2:37 PM
YAY !!!

GOT IT ...

It's actually quite silly that it doesn't work the way we tried originally, but I ended up finding a solution ...

Don't ask why it is the way it is ... it just is ... lol

I've done it so that you can just copy and paste the scripts into the objects ...
Here you go ...

------------------------------
VOLUME UP CONTROL
------------------------------

Dim sysvol

sysvol = System.Volume

Sub Object_OnMouseEnter

sysvol = System.Volume
Object.SetTimer 1, 1

End Sub


Sub Object_OnMouseLeave

Object.KillTimer 1

End Sub


Sub Object_OnTimer1

If sysvol < 100 Then
sysvol = sysvol + 1
System.Volume = sysvol
Else
Object.KillTimer 1
End If

End Sub


Sub Object_OnScriptExit

Object.KillTimer 1

End Sub

------------------------------
VOLUME DOWN CONTROL
------------------------------

Sub Object_OnMouseEnter

Object.SetTimer 1, 1

End Sub


Sub Object_OnMouseLeave

Object.KillTimer 1

End Sub


Sub Object_OnTimer1

If System.Volume > 0 Then
System.Volume = System.Volume - 1
Else
Object.KillTimer 1
End If

End Sub


Sub Object_OnScriptExit

Object.KillTimer 1

End Sub

------------------------------

I hope it works on your side too !! ... and it's really a pleasure !!
Let me know if it works ...

Thanks,
HaemOGObliN
Cyberium
Reply #3 Thursday, August 10, 2006 10:35 AM
Wow Haemo! That works like a dream Ku!

Have MSN? We can trade Scripting tips on there.. almost every object I make now involves a script at some point even if its just positioning! If ya get chance Add Me [email protected] (old address.. too lazy to change it...)
ZubaZ
Reply #4 Thursday, August 10, 2006 10:55 AM
I would suggest you post scripts here: http://scratchpad.wikia.com/wiki/DesktopX

The overall goal of this Wiki is to provide DesktopX coders with a resource from which to draw on pre-made code snippets and tutorials. Theres no need to be trying to remember how to properly assemble an XmlHTTP object, or a basic File System Object. Instead, we offer a place to grab quick assemblies of code to be used in whatever projects necessary. Please feel free to contribute with tutorials and script segments!

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!



web-wc01