a property list where the properties are symbols, but it doesn't
seem to work; it just falls through the loop. The same exact code
works when passed a property list where the properties are
integers.
From the AW7 function description of Repeat With In:
quote:
Repeat with X in list repeats the statements in the loop with
each of the elements in a list. Each time through the loop the
function assigns the next element in the list
or the next value in a property to the variable specified.
Since Authorware evaluates the list count each time through the
loop, statements that change the list inside the body of the repeat
may affect the loop. Authorware keeps a reference to the original
list for the duration of the loop. This means that the list
persists at least for the duration of the loop.
Syntax:
repeat with variable in list
statement(s)
end repeat
I assume they meant to say ''property list'' instead of just
''property''. That would indicate any kind of property list could be
used, no? Does anybody know if it should work or not? TIA.
- Jim
Using repeat with ... in ... Loops With...
''jsaiya'' %26lt;webforumsuser@macromedia.com%26gt; wrote in
message
news:eu1to2$kl3$1@forums.macromedia.com...
%26gt; I'm trying to use a ''repeat with variable in list'' loop
with a property
%26gt; list where the properties are symbols, but it doesn't
seem to work;
%26gt; it just falls through the loop. The same exact code
works when
%26gt; passed a property list where the properties are
integers.
I must admit I've always regarded 'Repeat With In' as only
for use with
linear lists (and personally I only use it with
single-dimensional linear
lists, I have seen problems when used with multi-dimensional
ones).
It doesn't work for me with property lists (where the
properties are
symbols), and as far as I can see it only works with property
lists (where
the properties are integers) in the special case where those
integers start
at 1 and are contiguous.
That is:
MyList:=[1:10,2:20,3:30]
total:=0
repeat with i in MyList
total:=total+i
end repeat
will loop through the complete list, but setting MyList to
[2:10,3:20,4:30]
or [1:10,2:20,4:30] will fail. And of course, if the integers
have to start
at 1 and be contiguous then presumably you may as well use a
linear list
instead.
Chris Forecast
Using repeat with ... in ... Loops With...
It definitely does not work for ordinary property lists.
To do this with property lists:
repeat with x := 1 to Listcount(pList)
prop := PropertyAtIndex(pList, x)
val := ValueAtIndex(pList, x)
--do stuff
end repeat
''Chris Forecast''
%26lt;chris_ng1@-nospam-chrisforecast.co.uk%26gt; wrote in message
news:eu2pob$mgm$1@forums.macromedia.com...
%26gt; ''jsaiya'' %26lt;webforumsuser@macromedia.com%26gt; wrote in
message
%26gt; news:eu1to2$kl3$1@forums.macromedia.com...
%26gt;%26gt; I'm trying to use a ''repeat with variable in list''
loop with a property
%26gt;%26gt; list where the properties are symbols, but it
doesn't seem to work;
%26gt;%26gt; it just falls through the loop. The same exact code
works when
%26gt;%26gt; passed a property list where the properties are
integers.
%26gt;
%26gt; I must admit I've always regarded 'Repeat With In' as
only for use with
%26gt; linear lists (and personally I only use it with
single-dimensional linear
%26gt; lists, I have seen problems when used with
multi-dimensional ones).
%26gt;
%26gt; It doesn't work for me with property lists (where the
properties are
%26gt; symbols), and as far as I can see it only works with
property lists (where
%26gt; the properties are integers) in the special case where
those integers
%26gt; start
%26gt; at 1 and are contiguous.
%26gt;
%26gt; That is:
%26gt;
%26gt; MyList:=[1:10,2:20,3:30]
%26gt; total:=0
%26gt; repeat with i in MyList
%26gt; total:=total+i
%26gt; end repeat
%26gt;
%26gt; will loop through the complete list, but setting MyList
to
%26gt; [2:10,3:20,4:30]
%26gt; or [1:10,2:20,4:30] will fail. And of course, if the
integers have to
%26gt; start
%26gt; at 1 and be contiguous then presumably you may as well
use a linear list
%26gt; instead.
%26gt;
%26gt; Chris Forecast
%26gt;
%26gt;
%26gt;
Thanks, Amy. I had resigned myself to using a regular ''repeat
with... to...'' loop anyway, and since that's the answer, that's
what I'll do.
Also, thanks, Chris.
- Jim
quote:
Originally posted by:
Newsgroup User
It definitely does not work for ordinary property lists.
To do this with property lists:
repeat with x := 1 to Listcount(pList)
prop := PropertyAtIndex(pList, x)
val := ValueAtIndex(pList, x)
--do stuff
end repeat
''Chris Forecast''
%26lt;chris_ng1@-nospam-chrisforecast.co.uk%26gt; wrote in message
news:eu2pob$mgm$1@forums.macromedia.com...
%26gt; ''jsaiya'' %26lt;webforumsuser@macromedia.com%26gt; wrote in
message
%26gt; news:eu1to2$kl3$1@forums.macromedia.com...
No comments:
Post a Comment