Dx Scripting Help
Wednesday, February 25, 2009 by DigitalT | Discussion: DesktopX Tutorials
I am very new to dx and scripting, so bare with me. I have a button that when pushed a tray slides out (called target6). On target6 there is another button that when pushed will open another tray called target9. Now when i push the original button that opens and closes target6, I would like it to not only close target6 but also target9. I don't want the main button to open target9 just close it. Here is just the script attached to the main button. Works perfectly. I have tried adding in just the closing portion of the script for target9 and it works, but it only works for target9 and not target6. Help Please.
[code]
'Called when the script is executed
Sub Object_OnScriptEnter
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit
End Sub
Sub Object_OnScriptEnter
desktopx.Object("Target6").top = 0
End Sub
Function Object_OnLButtonUp(x, y, Dragged)
If Dragged = False Then
If desktopx.Object("Target6").Left = 0 Then
object.KillTimer 100
object.SetTimer 200,10
Else
object.KillTimer 200
object.SetTimer 100,10
End If
End If
End Function
Sub object_ontimer100
If desktopx.Object("Target6").Left < 0 Then
desktopx.Object("Target6").Left = desktopx.Object("Target6").Left + 5
Else
object.KillTimer 100
End If
End Sub
Sub object_ontimer200
If desktopx.Object("Target6").Left > - 300 Then
desktopx.Object("Target6").Left = desktopx.Object("Target6").Left - 5
Else
object.KillTimer 200
End If
End Sub
[/code]
Reply #2 Wednesday, February 25, 2009 9:44 PM
Thanks for the reply will take all this into consideration. Hopefully I can come up with a working script. Will let ya know, thanks again.
Reply #3 Wednesday, February 25, 2009 9:48 PM
If not.. i will have some time over the weekend to look at things.. you could email me the dxpack.
Reply #4 Thursday, February 26, 2009 8:49 AM
I will send it your way. I looked over what you wrote and tried it out myself, but only came up with errors. Guess there is still a lot that I don't understand. Thanks
Reply #6 Thursday, February 26, 2009 10:12 PM
Wow, you are awesome, will dig into that later
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!
Reply #1 Wednesday, February 25, 2009 8:59 PM
in short (since i have no time to code)..
You need several vars.
'-- That sets all the drawers to "closed" in the vars
'now in the button that opens the 1st drawer :
' as i have pointed out in multiple other posts (see THIS ONE) i would suggest 1 MASTER object and ALL the other objects having "empty" scripts in them, so that all the code resides in 1 location. This allows you to easily keep track of things.
So lets say you named the button that opens the first drawer BTN1 & the btn that loads the 2nd slider BTN2 the code would look like: -- keep in mind CaSe is important here
Ok i know its not 100% but it should put you on the right track.
1. always keep the code in 1 master object
2. use VARS to store open/closed states, etc.
3. i like to use DIM var so that you dont need things like Drawer1, Drawer2, drawer3, etc.. its all a DIM.. ie: Drawer(1), (2), (3) and its easy to traverse this list.
4. look at what others have done (Zu calls this STEALING but if you dont take their code, just the ideas, or if you ask for the code, its not Stealing) and see how others have done what you are trying to do
5. ok this sounds lame, but i wonder how many people do this.. TRY GOOGLE... ie: DesktopX Slide or DesktopX Buttons, etc.
Good luck