Random motion with irregular shape

Hello,

I’m using Flash5 and was wondering if anyone knows how to create random motion of an object within an irregular shape?

I have an ob-long rectangle which ‘flares’ on each end and would like to place some graphics in random motion within this irregular shape. Kirupa has a nice tutorial on random motion, which I can follow and re-produce no problem. However, with his tut, he uses

movie_height = 150;
movie_width = 300;

But I want to specify the top, bottom, left and right edges, which are irregular. Should I create a mask and use that? or can I achieve this another way using actionscript? thanks for your help!! dave.