pua jeand <[EMAIL PROTECTED]>
> when sprite 1 didn't move 1 min(ex.using Draggable behavior in
> sprite 1), then it will auto detect the behavior from library
>(ex.Random Movement and Rotation) and run the function.
Hi jeand,
Drop both the Draggable and the Random Movement and Rotation behaviors
onto your sprite.
In the Draggable behavior, delete the "on beginSprite", "on mouseUp",
"on mouseDown" and "on prepareFrame" handlers, and replace these with
the following...
on prepareFrame
on beginSprite me
-- determine sprite object reference
pSprite = sprite (me.spriteNum)
vMember = pSprite.member
case vMember.type of
#animGIF, #flash, #QuickTimeMedia, #digitalvideo, #vectorShape:
if vMember.directtostage then
alert "Sprite" && pSprite.spriteNum & �
": Direct To Stage media may cause" && �
"playback problems with the 'Moveable Sprite' behavior."
end if
end case
-- set activity flag
pActive = FALSE
startTimer
end beginSprite
on mouseUp me
-- turn off activity flag when mouse is released
mDrag FALSE
end mouseUp
on mouseDown me
-- turn on activity flag when mouse is clicked
call(#toggleActive, pSprite.scriptInstanceList, 0)
mDrag TRUE
end mouseDown
on prepareFrame me
-- if mouse has somehow moved off of sprite and been released
-- turn off activity flag
if the mouseUp then mDrag FALSE
-- if active, move sprite to follow cursor
if pActive then
mDragSprite me
startTimer
else if the timer > 3600 then -- 1 minute: CUSTOMIZE DELAY HERE
call(#toggleActive, pSprite.scriptInstanceList, 1)
end if
end prepareFrame
In the Random Movement and Rotation behavior, delete the current "on
prepareFrame" handler and replace it with the following...
property pActiveFlag
on prepareFrame me
if pActiveFlag then
mUpdate me
end if
end prepareFrame
on toggleActive(me, state)
activeFlag = (state = 1)
if pActiveFlag = activeFlag then
exit
end if
pActiveFlag = activeFlag
if pActiveFlag then
pPath = VOID
mInitialize(me)
end if
end toggleActive
The Random Movement and Rotation behavior will now become active if the
user does not click on the sprite for a full minute. It will stop being
active it the user then clicks on the sprite.
NOTE: this technique requires the minimum in cut-and-paste changes to
your scripts. It is not an optimal solution, since it constantly resets
"the timer" movie property during dragging, and effectively prevents you
from using "the timer" for any other purpose.
Cheers,
James
[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!]