alexandre_lab
12-06-2003, 08:05 PM
Hello !
I'm trying to use javascript to retrieve some properties of a swf file (the width and height) and use them to affect the "embed" code.
The reason i do this (and not hardcode the width and height) is that users can upload their flash file on my website's database. I don't want to rely on them telling me the width and height, but would prefer to get the real value out of the file.
i found a technote that seems to enable me to do it:
http://www.macromedia.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_04.html
but i can't make it work so far :(
Here is my code, can someone tell me what i'm doing wrong ?
<script type="text/javascript" language="javascript">
<!--
var finalwidth=window.document.navmovie.TGetProperty("/",8);
var finalheight=window.document.navmovie.TGetProperty("/",9);
</script>
the embed code is:
<script>
document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.writeln('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ID="navmovie" width="'+ finalwidth + '" height="' + finalheight + '" hspace="0" vspace="0" align="middle">');
document.writeln('<PARAM NAME=movie VALUE="filez/' + file + '"><PARAM menu=false quality=high>');
document.writeln('<EMBED name="navmovie" src="filez/' + file + '" menu=false quality=high bgcolor=#000000 swLiveConnect="true" width="' + finalwidth + '" height="' + finalheight + '" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
</script>
Thanks a lot for your help !
alex
I'm trying to use javascript to retrieve some properties of a swf file (the width and height) and use them to affect the "embed" code.
The reason i do this (and not hardcode the width and height) is that users can upload their flash file on my website's database. I don't want to rely on them telling me the width and height, but would prefer to get the real value out of the file.
i found a technote that seems to enable me to do it:
http://www.macromedia.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_04.html
but i can't make it work so far :(
Here is my code, can someone tell me what i'm doing wrong ?
<script type="text/javascript" language="javascript">
<!--
var finalwidth=window.document.navmovie.TGetProperty("/",8);
var finalheight=window.document.navmovie.TGetProperty("/",9);
</script>
the embed code is:
<script>
document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.writeln('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ID="navmovie" width="'+ finalwidth + '" height="' + finalheight + '" hspace="0" vspace="0" align="middle">');
document.writeln('<PARAM NAME=movie VALUE="filez/' + file + '"><PARAM menu=false quality=high>');
document.writeln('<EMBED name="navmovie" src="filez/' + file + '" menu=false quality=high bgcolor=#000000 swLiveConnect="true" width="' + finalwidth + '" height="' + finalheight + '" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
</script>
Thanks a lot for your help !
alex