----- Original Message ----- 
From: "Christoffer Enedahl" <[EMAIL PROTECTED]>
> >
> >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.
>
> try:
> if not voidP( sprite(k)[#myBuiltInCursor] ) then

Note that you cannot call sprite(x).getaProp(y) (using square brackets calls
getaProp internally) unless the sprite has entries in the
scriptInstanceList. So, to avoid script errors, first check
sprite(x).scriptInstanceList.count, then check for the property. It can't
have the property if the scriptInstanceList is empty anyway. For example:

on mouseUp me
  repeat with i = 1 to the lastChannel
    if( sprite(i).scriptInstanceList.count ) then
      if( not voidP( sprite(i)[ #myBuiltInCursor ] ) ) then
        sprite(i).cursor = sprite(i).myBuiltInCursor
      end if
    end if
  end repeat
end

- Robert

[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