PDA

View Full Version : How to pass innerHeight from javascript to Flash MX


AlexMarthin
01-21-2003, 08:09 PM
I've been trying to pass the javascript variable "innerHeight" into Flash MX, with no success however.
I would like the content of my flash movie change as the user changes the size of the browser window.

Thanks,
Alex

Simbiot
01-23-2003, 10:57 PM
I don't know if this will work for you, but you can pass variables to flash like:

path/to/swf/flashMovie.swf?jsInnerHeight=<script language=javascript>document.write(screen.innerHeight);</script>

AlexMarthin
01-24-2003, 08:02 AM
Thanks Simbiot

At first I couldn't get the code to work. First of all I didn't realise that innerHeight doesn't work in Explorer, secondly the data that was passed into flash was the actual javascript code. However I solved it by putting all of the embed code into javascript like this:

<script>document.write('<embed src="loadvar.swf?jsInnerHeight='+document.body.clientHe ight+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="320" height="240"></embed>');</script>

Thanks again for your help :)