What you've written doesn't match my experience. Specifically, when
you said, "Using the 'on prepareFrame' handler in a sprite script
will execute the commands within it only once."
So, I built a test case - a small movie that only has two scripts.
As the frame script for frame 1, I wrote:
on prepareFrame me
put "in prepareFrame of Frame script"
end
on beginSprite me
put "in beginSprite of Frame script"
end
on exitFrame me
go to the frame
end
I put a simple graphic in channel 1 of frame 1 and added the following script:
on prepareFrame me
put "in prepareFrame of script channel"
end
on beginSprite me
put "in beginSprite of script channel"
end
Then I ran the program. Here is the output from the message window:
-- "in beginSprite of Frame script"
-- "in beginSprite of script channel"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
-- "in prepareFrame of script channel"
-- "in prepareFrame of Frame script"
As expected, the beginsprites from both the frame and script channels
execute once, but the prepareFrame scripts BOTH execute every frame
event.
As others have stated, the "on beginsprite" in any frame or script
channel script is a great place to put initialization code. (And
using the "on endSprite" is a great place to put any clean up code.)
Irv
At 10:09 PM +1100 3/30/02, Tom Hines wrote:
>Hi all,
>
>I've made some discoveries and am a little baffled.
>
>When looping in one frame:
>--------------------------
>Using the 'on prepareFrame' handler in the frame script will execute
>the commands within it every time the frame loops.
>Using the 'on prepareFrame' handler in a sprite script will execute
>the commands within it only once.
>
>Using the 'on beginSprite' handler in a sprite script will execute
>the commands within it only once.
>Using the 'on beginSprite' handler in the frame script will execute
>the commands within it only once.
>
--
Lingo / Director / Shockwave development for all occasions.
(Home-made Lingo cooked up fresh every day just for you.)
[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!]