Get the members of a group
Bob Sneidar
bobs at twft.com
Wed Apr 25 12:46:03 EDT 2012
You delete grc 1 in the first iteration. Now grc 2 BECOMES grc 1, but the next iteration deletes grc 2! You are deleting every other grc this way. You have to start at the end and work your way backward. Think of it as taking a cracker off the bottom of the stack. Cracker 2 now becomes cracker 1.
Another way is to repeat for count instead of repeat with i = 1 to count and then delete graphic 1, not I, in your count up loop.
Bob
On Apr 25, 2012, at 9:31 AM, Michael Doub wrote:
> Can someone explain what is going on here? This works:
>
> Put the number of graphics of me into count
> repeat with i = count down to 1
> if the short name of graphic i of me is not "TreeBG" then
> delete graphic i
> end if
> end repeat
>
> This does not:
> Put the number of graphics of me into count
> repeat with i = 1 to count
> if the short name of graphic i of me is not "TreeBG" then
> delete graphic i
> end if
> end repeat
>
> Why is the order significant?
>
> -= Mike
>
>
>
> On Apr 25, 2012, at 11:45 AM, Klaus on-rev wrote:
>
>> Hi Colin,
>>
>> Am 25.04.2012 um 17:34 schrieb Colin Holgate:
>>
>>> Should you be doing the repeat loop defending?
>>
>> hehe, "defending" :-)
>> Took me a while...
>>
>> Yes of course:
>> ...
>> put the num of grcs of grp "your group here" into tNum
>> repeat with i = tNum down to 1
>> ## caress grc i of grp "your group here" :-)
>> end repeat
>> ...
>>
>>
>> Best
>>
>> Klaus
>>
>> --
>> Klaus Major
>> http://www.major-k.de
>> klaus at major.on-rev.com
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list