View Full Version : Show groups of objects from single event
pjvbh
09-10-2002, 12:17 PM
Hi:
I would like groups of text objects to show/hide from a single click on a hotspot.
For example, I might have text objects named
Text00_0
Text00_1
Text00_2
Text01_0
Text01_1
etc
... and a %textGroup% variable set by a mouse click to 00, 01, etc.
... and then something like:
Page.ShowObject=("Text + %region% + *")
Can a string be made to concatenate "Text" + %textGroup% + wildcard characters and then used with a single SHOW action?
Thanks,
Lorne
09-10-2002, 12:29 PM
Nope. The actions don't support wildcards for the object names at all.
But, you can definitely concatenate text with an expression (using a "Variable - Set Value" action), or even just mix-n-match the variable with the text to form the value you want.
If you only have a few objects, it'll probably be easier to just use separate Show and Hide actions for them.
If you have a lot of objects, though, you could try using a While loop, like this one that would hide 10 objects:
<pre>%i% = 10
WHILE (%i%)
Page.ShowObject=("Text%region%%i%")
%i% = Evaluate(%i% - 1)
END WHILE</pre>
Lorne
09-10-2002, 12:44 PM
In fact, here's an example (http://www.indigorose.com/ubbthreads/uploads/11388-Dynamic%20show%20and%20hide.am4) that will show you how it works. /ubbthreads/images/icons/smile.gif
11388-Dynamic show and hide.am4 (http://www.indigorose.com/ubbthreads/uploads/11388-Dynamic show and hide.am4)
pjvbh
09-10-2002, 01:01 PM
Lorne:
Thanks very much for the WHILE loop example; it tells me everything I need to know for this page!
Lorne
09-10-2002, 01:12 PM
You're welcome Phillip. /ubbthreads/images/icons/smile.gif I was curious to see if it would work. /ubbthreads/images/icons/wink.gif
pjvbh
09-12-2002, 12:08 PM
... From the should work but doesn't department :-)
OK, I can't see why this (see attached) does not work.
The WHILE loop that hides the objects is never executed, but I cannot see while the condition is not met. Is there some other factor getting in the way here?
Hope I have attached this list correctly ...
11571-actionlist.txt (http://www.indigorose.com/ubbthreads/uploads/11571-actionlist.txt)
Lorne
09-12-2002, 12:19 PM
You aren't initializing %i% to anything before the WHILE loop. The %i% variable will be seen as that exact text (%i%) and so the >= operator in the expression:
%i% >= 0
...will perform a string comparison between the word "%i%" and the word "0".
% comes before 0 in the ASCII table, so that test ends up being false right from the get-go.
That's probably your answer...unless you're initializing %i% some integer larger than -1 somewhere else (i.e. in another action list that happens before this one).
pjvbh
09-12-2002, 12:40 PM
Here is the complete action list -- I hope.
I believe that before the WHILE test runs, %i% will have been set:
%i% = "1" (or "2", etc, depending which hotspot was clicked)
Do I need to do that differently to make it an integer rather than a word?
Anyway, while testing I put a text box on the page and set it to display %i% -- and it looked like a 1 was there before the WHILE condition is tested :-)
Is the Equal operator not the correct one to test if %i% has the value 1?
11574-actionlist2.txt (http://www.indigorose.com/ubbthreads/uploads/11574-actionlist2.txt)
pjvbh
09-12-2002, 01:00 PM
I have found my error - the value of i was set -- but then un-set again -- by a previous WHILE loop. I must remember to keep refreshing the values of those test text objects. Oops.
Thanks for your help!
Lorne
09-12-2002, 01:06 PM
Do I need to do that differently to make it an integer rather than a word?
Nope. There's actually no difference...AutoPlay figures out what you meant by the context. For example:
1 + 1
both values are numbers, so an addition is performed: 2
1 + tree
one of the values is obviously a string, so concatenation is performed: 1tree
1.2.4 + 1.0.1
the values both have more than 2 decimal points, so a "version addition" is performed: 2.2.5
Powered by vBulletin™ Version 4.0.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.