Hello,

-- Parent Script: Move --
property pSprite
property pLocH
property pIncrement

on new(me, aSprite)
  pSprite = aSprite
  pLoch = pSprite.locH
  pIncrement = 1
  _movie.actorList.append(me)
  return(me)
end

on stepFrame(me)
  pLocH = pLocH + pIncrement
  if(pLocH > 500) then
    _movie.actorList.deleteOne(me)
  end if
  pSprite.locH = pLocH
end

-- Start Movie --
on startMovie()
  script("Move").new(sprite(1))
end

on stopMovie()
  _movie.actorList = []
end

-------------------------------------------------

The statement in the stopMovie() handler is of great functionality, but it
has a drawback that it deletes all the objects attached to the sprite. In
the on new(me, ...) handler I tell the object to add itself to the actorList
by saying _movie.actorList.append(me), right? But I wonder what is the most
efficient way to make the object remove itself from the actorList? Let's say
in the "Move" script we have the following condition and an action applied:

on stepFrame(me)
  pLocH = pLocH + pIncrement
  if(pLocH > 500) then
    _movie.actorList.deleteOne(me)
  end if
  pSprite.locH = pLocH
end

Is that a good way to make the object remove itself from the actorList? I
have tried many other techniques but they don't work.

TIA
Pedro



[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