One out-of-the-box thought is to use XHR to grab the binary contents of the file, and then apply the same file inspection techniques that you can see that PHP code does... theoretically, this should be possible.
IE supports binary response inspection natively, but there are some cautions that have to be taken to make it work in the other major browsers. See here: http://squio.nl/blog/2006/08/24/retrieving-binary-data-with-xmlhttprequest-again/ >From there, it should just be a matter of taking the relevants parts of the PHP code and porting to javascript. It should be noted, however, that this will still require downloading the file once to determine dimensions, and then a second time for the flash (the browser cache may be smart enough to not require a second full download, but certainly a second load into flash memory will be required). ------------------------------- However, another option would be to take off what Philip suggests, but do so with a more intelligent "shell" SWF. It should be possible to have a shell swf that loads your main SWF file as a child, tells the javascript the dimensions of the SWF, which then CHANGES the dimensions of the shell's object dynamically (via CSS, for instance)... and then the shell swf uses it's scale-mode settings to prevent it from scaling with that resize, and then finally it displays the child swf directly inside the newly sized shell object. This process might be tedious to code correctly, but it should work if you are pretty familiar with actionscript and javascript. --Kyle -------------------------------------------------- From: "gumphfy" <[EMAIL PROTECTED]> Sent: Thursday, October 09, 2008 3:54 PM To: "SWFObject" <[email protected]> Subject: Re: auto detect dimensions of flash movie > > Thanks, but I was really hoping for a JS or an AJAX solution, since my > (free) host has file-access disabled. > I've used getimagesize() before to get the dimensions, but that's not > an option. > > Thanks anyway. > Any other way to solve this? > > On Oct 9, 10:24 pm, "Philip Hutchison" <[EMAIL PROTECTED]> wrote: >> you can use PHP to get the SWF's size dimensions before embedding the SWF >> to >> your HTML page. >> >> http://www.sephiroth.it/swfreader.php >> >> - philip >> >> >> >> On Thu, Oct 9, 2008 at 12:17 PM, gumphfy <[EMAIL PROTECTED]> wrote: >> >> > How can I detect the dimensions (width&height) of a flash file, and >> > then use those values with SWFObject? >> >> > I've tried somehting like: >> >> > function getDimensions() { >> > var obj = document.getElementById('movie'); >> > var w = obj.TGetProperty('/',8); >> > var h = obj.TGetProperty('/',9); >> > } >> >> > swfobject.embedSWF("flash.php?id='.$id.'", "movie", + w, h, + "9.0.0", >> > "expressInstall.swf"); >> >> > I have absolutely no knowledge of javascript what-so-ever, but >> > searching around the web resulted in the above. >> > That doesn't work however. >> >> > So how do I make it work? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/swfobject?hl=en -~----------~----~----~----~------~----~------~--~---
