[EMAIL PROTECTED] wrote:
> 
> Hello,
> I'm a becomer and my English is not well. I have got a
> question that I want to use the statement to set a behavior
> into a sprite or much more. I tried to use the "sendsprite"
> and "sendallsprites" statement but unsuccessfull. Somebody
> help me???

To attach a behaviour using lingo you can use something like:

sprite(1).scriptInstanceList.add(new(script"foo"))

or

add(sprite(1).scriptInstanceList,(new(script"foo")))

They both do the same thing. Use the one you like best.

Then you can use sendSprite to set it's properties thorough a property
setting handler.

Altering the scriptInstanceList is nice because you don't have to keep
track of what else is already in the list (not that you shouldn't
know...) and it's easy to place a behaviour _where_ you want it in the
list (the behaviours are called in the order they appear in the list)
without having to re-format a string of test. The drawback is that you
don't get to set the properties in the same command.... unless...

if your behaviour 'foo' has something like this:

property pA
property pB

on new me, a, b
  pA = a
  pB = b
  return me
end

then you could do:
sprite(1).scriptInstanceList.add(new(script"foo",a,b))

but having a property-setting handler would be cleaner and make it
easier to change the properties later.

something like:

on setprops me, a, b
  pA = a
  pB = b
end

which you would call with:
sendsprite(1,#setprops,a,b)

Interesting... these applied behaviours don't seem to show in the sprite
property inspector (D8.5 Mac)

-- Carl
[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