Object Controller question

Simultaneous Control

I want to create an object controller that could toggle two objects simultaneously in such a way that when one hides the other shows up.

Let me explain, I have created two objects A and B. Now i want the same object controller (C) or else the same button (C) to toggle A and B alternately. So that when I first press C, A disappears while B shows up and when I again press C , B disappears and A shows up and so on.

Can anyone help me out with this? ...so far i can't figure it out although i've tried using the visibility option in both A and B alternately, so that in one it is set to be visible by default while in the other it is set to be invisible by default. But it doesn't work!
2,767 views 5 replies
Reply #1 Top
Here's one using Opacity. Make sure you set objB to 0 transparency before starting.

Function Object_OnLButtonDown(x, y)
If DesktopX.Object("objA").Opacity = 100 Then
DesktopX.Object("objA").Opacity = 0
DesktopX.Object("objB").Opacity = 100
Else
DesktopX.Object("objA").Opacity = 100
DesktopX.Object("objB").Opacity = 0
End If
End Function
Reply #2 Top
without using script...you need to set each so that the other does not show when one is visible.

I went through hell trying to figure this out in my last DXTheme.

I used messages in the states to control the objects. You can check it out and see how I used it on the 2 main docks.

I set one as not visible and the other viible. With the controlling obect for each, I used the mouse down, mouse up, and command execute to open or hide them and set each so that when one was visible the other was not. I did it all using the states and messages. I don't know jack about scripting.

Zubaz was a lot of help in explaining the staes to me. Maybe he'll turn up and explain it better.
Reply #3 Top
thx a lot Po.

that never even occured to me but, definitely better to max out these existing features. great.
Reply #4 Top
Thanks alot both of you guyz. Yea Smedley, i may also try that if the script doesn't work for me but as you said it'll need alot of experimenting and trial and error stuff so i am kind of avoiding that. Thanks alot man!



SirSmiley, thanx for the script and it pretty much does what i wanted to do but the only problem now is that using the object controller plugin i had added animation to both the objects A and B. Is there a way that i can add animation to it using scripting too? ...once again thanks alot for both of you guys' help, i really appreciate it.
Reply #5 Top
Thanks alot guys for your help, I finally figured it out! I don't know nothing about scripting and if not for you guys i'd probably have given up. i wrote and put this in object A to alternate how they both were toggled:

Function Object_OnStateChange(state)
If state = "Hide" Then
DesktopX.Object("objB").Opacity = 40
Else
DesktopX.Object("objB").Opacity = 0
End If
End Function

And yea i wanted the object B at 40% opacity when it was visible, now i can still have the animation in the object A while toggling both of them alternately. Thanks once again guyz. You've been of great help!