You may set the keyDownScript. Then you do not need a movie script and do not
have to specify the sprite channel number to attach the behavior. I reviced
Ramesh's code as follows:
------------- sprite script for sprite you want to change the cast
property pMemberList, pIndex
property spriteNum, pnMemberCount
on beginsprite me
pMemberList = [1,2,3] -- this list contains cast member numbers
pIndex = 0
pnMemberCount = pMemberList.count
the keyDownScript = "sendSprite(" & spriteNum & ", #xKeyDown, the keyCode)"
end
on xKeyDown me, nKeyCode
case nKeyCode of
123:
me.changeCast(-1)
124:
me.changeCast(1)
end case
end
on changeCast me, nextPrev
pIndex = max(1, min(pnMemberCount, pIndex + nextPrev))
sprite(spriteNum).member = member(pMemberList[pIndex])
end
_____
Ramesh C T wrote:
> ------movie script
> on keydown
> if the keyCode = 123 then
> -- change the spriteNumber to the channel number
> -- of sprite that you want to change the cast
> sendSprite(spriteNumber, #changeCast, -1)
> else if the keyCode = 124 then
> sendSprite(spriteNumber, #changeCast, 1)
> end if
> end
>
> ------------- sprite script for sprite you want to change the cast
> property pMemberList, pIndex
> on beginsprite me
> pMemberList = [1,2,3] -- this list contains cast member numbers
> pIndex = 0
> end
>
> on changeCast me, nextPrev
> pIndex = pIndex + (1 * nextPrev)
>
> if pIndex < 1 then
> pIndex = 1
> else if pIndex > pMemberList.count() then
> pIndex = pMemberList.count()
> end if
>
> sprite(me.spriteNum).member = member pMemberList[pIndex]
> end
> -------------
Good luck,
Fumio Nonaka
Attain Corporation
[EMAIL PROTECTED]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]
- <lingo-l> casts JUAN COLON
- Re: <lingo-l> casts Ramesh C T
- Re: <lingo-l> casts Ramesh C T
- Fumio Nonaka
