|
talking to another behavior
At 12:51 06/04/99 +0100, Daniel Brown wrote:
>
>In the beginSprite of a low channel number , say 10, I'm sending a message
>to a higher sprite using sendSprite ( 20, #bob) ...
>
>Anyway, the higher sprite is not recieving this event... It leaves me to
>conclude that in d6.5 you can't send a message to a sprite that has not yet
>recieved its own beginSprite event... This sounds resonable, I'm I right?
>
>Interestingly enough though - it works fine in D7.
>
Does it? Would you mind providing an example?
I used the behavior below to test and received identical results under dfw 6.02 and d7.0 which
look to me like indeed a sprite won't receive a message before its own beginSprite event. Which
is exactly what I expected to happen.
(four sprites in channel 1,2,3,4 with the same behavior attached, go the frame loop)
--- Behavior script "TestBeh"
property spriteNum, myLpPartner,myself
on beginSprite me
set myLpPartner = [:]
set mySelf = #testBeh
sayhello me
end
on sayHello me
set dLp = [:]
sendAllSprites(#merhaba, dLp)
sendAllSprites(#setPartner,dLp)
put spriteNum,myLpPartner
end
on merhaba me,dLp
addProp dLp,mySelf,spriteNum
end
on setPartner me,dLp
set myLpPartner = dLp
end
-- Welcome to Director --
-- 1 [#TestBeh: 1]
-- 2 [#TestBeh: 1, #TestBeh: 2]
-- 3 [#TestBeh: 1, #TestBeh: 2, #TestBeh: 3]
-- 4 [#TestBeh: 1, #TestBeh: 2, #TestBeh: 3, #TestBeh: 4]
|