Click to See Complete Forum and Search --> : Flash - Dynamically affect stage dimensions?


tarsus
03-18-2009, 05:02 PM
I'm working on a Flash file that can dynamically import any FLV depending on a name passed in as a FlashVar. I'd ideally like it to be able to handle FLVs of any size, and therefore I need the ability to dynamically change the height and width of the stage. Is this possible? (I'm working in ActionScript 3 and would like to keep it that way.)

Please note that, as far as I can see, changing the SWFs dimensions in the HTML will not work. If I set the stage to, say, 500 x 350, and a particular FLV is 200 x 120, the extra space will be there no matter how big or small I size the SWF in the HTML. (Not to mention the fact that I can't dynamically get the FLV's dimensions to use in the HTML.)

Eye for Video
03-18-2009, 09:41 PM
Change the size of the stage dynamically… Huuummmm…not sure about that..??? But that’s never stopped me from giving advice before…!! So here goes… can I just think out loud??
If it was just the Flash doc that you were working with and not the HTML page, perhaps you could use percentages of the stage to dynamically change the video display area. But you would need to know the dimensions of the various incoming flv files. Huumm. Typically flv files will have at least basic metadata embedded in the file. That metadata should include the dimensions and is available to Actionscript. I’ve used “trace” to retrieve it so perhaps you could incorporate the metadata to get the flv dimensions. Google flv metadata for more info.
The biggest problem I see is the connection between the Flash swf and the HTML coded into the page. So you can get the various videos to play….. perhaps you can get a metadata reader to retrieve the dimensions and connect with JavaScript to dynamically change the coded size of the <object> or <div> holding the .swf. But remember, changing the <div> dimensions may cause unexpected results on your HTML page.
Another approach would be go just go with the largest stage needed, center all video, and use “wmode transparent” to match the HTML page color. Or create a colored or graphic background in the swf which would show if the video was smaller than 100%.
Good luck to you on this project,
Eye for Video
www.cidigitalmedia.com