I've done tests before, using sendAllSprites() is about 7 times faster
than using repeat with i = 1 to the last channel.  Seems
sendAllSprites performance is also depended on the amount of sprites
with behaviors.  SendAllSprites on a frame with only a few behavior
takes almost no time to perform. Using repeat with i = 1 to the
lastchannel will take nearly the same amount of time regardless how
many sprites have behaviors.

By counting using the last channel, you will need 3 loops to get your
code correct:

 repeat with k = 1 to the lastChannel
    repeat with l = 1 to sprite(k).scriptInstanceList.count
      repeat with m = 1 to sprite(k).scriptInstanceList[l].count
        if sprite(k).scriptInstanceList[l].getPropAt(m) = #myBuiltInCursor then
          sprite(k).cursor = sprite(k).myBuiltInCursor
        else
          nothing
        end if
      end repeat
    end repeat

HTH

- ca

On Fri, 2 Jul 2004 08:54:35 -0500, John Mathis <[EMAIL PROTECTED]> wrote:
> 
> Yes...but...if it has a "certain custom property", could that behavior not
> also have a "certain method"?  Then you could just use
> sendAllSprites(#certainMethod).  More specifically to your case:
> sendAllSprites(#useBuiltInCursor)  This would be much more efficient than
> testing each behavior instance of each sprite.
> 
> John
> 
> 
> 
> ----- Original Message -----
> From: "Lee Blinco" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, July 02, 2004 5:04 AM
> Subject: <lingo-l> detect sprites with a certain property
> 
> > Hi
> > is it possible to loop through all sprites in the score and detect whether
> > each sprite has a certain custom property.
> > If the sprite has any custom properties then i can use
> >
> > repeat with k = 1 to the lastChannel
> >     repeat with l = 1 to sprite(k).count()
> >       if sprite(k).getPropAt(l) = #myBuiltInCursor then
> >         sprite(k).cursor = sprite(k).myBuiltInCursor
> >       else
> >         nothing
> >       end if
> >       end repeat
> >     end repeat
> >
> > but this fails when a sprite has no properties  as it returns a "handler
> not
> > in object error".
> > so is it poosible to test for whether a sprite has any custom properties
> at
> > all or not.
> > chhers
> > Lee Blinco
> > Multimedia Developer
> > AVR Productions
> > +44 (0)1462 819603
> >
> >
> > [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/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!]
> >
> >
> 
> [To remove yourself from this list, or to change to digest mode, go to 
> http://www.penworks.com/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!]
>
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/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