> You didn't say how you want to get out of the loop, but...

>From a recent post, I have a hunch Juan is wanting to rotate thru a certain
pre-defined set of members in a list, probably doing this:


sprite(mySpr).memberNum = sprite(mySpr).memberNum + 1


Juan, if this is what you're looking for, you'll need to set up a list of
all the possible members you want to cycle through, and check the bounds of
the list when incrementing members.  Use an index variable that points to
the current member in the list.

--<untested lingo typed in email app>

property lsMembers
property iCurMemIndex

on beginSprite me
  -- initialize props
  lsMembers = buildListOfMembers( me, 10,20 )
  iCurMemIndex = 1
  sprite(me.spriteNum).memberNum = lsMembers[ iCurMemIndex ]
end


on buildListOfMembers me, intFirstMemberNum, intFinalMemberNum
  ls = []
  repeat with i = intFirstMemberNum to intFinalMemberNum
    lsMembers.add( i )
  end repeat
  return ls
end


on switchToNextMember me
  iCurMemIndex = iCurMemIndex + 1
  -- THIS IS THE 'LOOPING' YOU ASKED FOR
  if iCurMemIndex > lsMembers.count then
    iCurMemIndex = 1
  end if
  
  sprite(me.spriteNum).memberNum = lsMembers[ iCurMemIndex ]
end

--</untested lingo>

Put this lingo into a behavior script and drop it onto the member you want
to increment.  You'll need to change the hard-coded numbers you send to the
buildListOfMembers handler, and it'd be best to set them as user-defined
properties by putting them into a getPropertyDescriptionList handler.

Conversely, you could use the "Cycle Graphics" behavior in the Behavior
Library.

Rob

/*********************************
* Rob Wingate, Software Human    *
* http://www.vingage.com         *
* mailto:[EMAIL PROTECTED] *
*********************************/

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to