Dynamically resize flash?

is there a way to dynamically resize document dimensions via actionscript?

scenario: i have downloaded the xml photogallery tutorial (http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) and i am trying to determine if there is a way to dynamically resize the flash file when an image dimensions are larger than the document dimensions.

(i figured that i would have to post my embed tag without height and width to make this work - and that seems to work when testing.)

i appreciate any and all feedback.