Where is the code above attached? When you select the code cast member in the library and open the Property Inspector and activate the Script tab, what Type of script does it indicate this code is?
The code is attached to sprite 28 and is type behaviour.
Is behaviour not correct because it is causing the sprite to change it properties?
Hmm, where to begin? Part of the problem is that the beginSprite handler only gets called one time for the sprite - even if the movie is looping. And I have to assume you have your movie set to loop, otherwise Director will execute the prepareFrame handler, execute the beginSprite handler and then go on to the next frame of the movie! The code you have in that handler would have been better served in an exitFrame handler, plus you ought to add the line "go to the frame" to keep the script looping on that frame, and keep the prepareFrame and exitFrames repeatedly firing. But then again, why not remove the prepareFrame handler, and just put the "pIncrement = random(240)" as the first line of the exitFrame handler?
Then there's the problem of the fact that the "loc of sprite(28)" is a point with a locH and a locV value. If you add an integer to this, the integer will be added to both the locH and the locV. Is that what you really wanted? This script (with my suggested changes) is only going to keep the sprite moving down and to the right until (and only if) the sprites eventually intersect, then it will keep moving the sprite to the right 5 pixels at a time until they don't intersect anymore, then continue moving down and to the right forever. Cool.