Generating Rectangle on Movieclip (AS3)

Hello, I was wondering if anyone could enlighten me as to how I could generate a rectangle movieclip on top of the longest section of a frame of a movieclip using AS3?

If this is the movieclip frame, I want it to find the longest portion of the movieclip on the right.

And then generate a rectangular movieclip on the longest section of the frame on the right side.

(Don’t mind the white bg, I just used paint quick, it won’t be there)

Does anyone know where I can begin. I can figure out how to generate the rectangle and all of that, but I am confused as to how I could determine the length of the longest portion of the movieclip, and how to tell AS3 to place it there.

Any help is appreciated,
Scheisse