Opacity in VBScript

Sunday, April 10, 2005 by Malice12 | Discussion: DesktopX Development

Has any one tried to use the opacity method of the desktopX.object class? I've written the following bit of code, it simply moves the object across the screen and makes it slowly disappear. Or it's supposed to. When I run this code the object moves ok, but the opacity isn't updated. When I uncomment the msgbox line below it works perfectly. Is there some kind of refresh method that I need to call?

Also, I'd like to avoid using a "sleep" call to slow this function down as it stalls all my other desktopX object at the same time. What's the best way to "pause" one desktopx object and release the process so that it can do other things?

Any and all help appreciated.


Function Object_OnLButtonDown(x, y)
desktopx.Object("YBar").left = 810
desktopx.Object("YBar").Opacity =100
counter = 0
For i = 1 To 100
desktopx.Object("YBar").left = 810 - i*8
counter = counter + 1
If counter = 10 Then
counter = 0
desktopx.Object("YBar").Opacity =100-i
'msgbox desktopx.Object("YBar").Opacity
End If
Next
desktopx.Object("YBar").left = 810
desktopx.Object("YBar").Opacity =100
End Function

JavaScout
Reply #1 Sunday, April 10, 2005 11:23 PM
Probably a timer is the best bet
Something like this

Dim xPos
Dim xOrig
Dim xInc
Dim oppValue

'Called when the script is executed
Sub Object_OnScriptEnter
xOrig = DesktopX.Object("YBar").Left
DesktopX.Object("YBar").Opacity = 100
xInc = int (xOrig/ 100) + 1
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit
Object.KillTimer 432
DesktopX.Object("YBar").Left = xOrig
DesktopX.Object("YBar").Opacity = 100
End Sub

Function Object_OnLButtonDown(x, y)
Object.SetTimer 432, 100
End Function

Sub Object_OnTimer432
xPos = DesktopX.Object("YBar").left - xInc
oppValue = DesktopX.Object("YBar").Opacity - 1
If (oppValue < 0) Then
oppvalue = 0
End If
If (Xpos) < 0 Then
Object.KillTimer 432
DesktopX.Object("YBar").Left = xOrig
DesktopX.Object("YBar").Opacity = 100
Else
DesktopX.Object("YBar").left = Xpos - xInc
DesktopX.Object("YBar").Opacity = oppValue - 1
End If
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!



web-wc01