RedRobotHero
Technical User
So I am trying to make a script that resizes a flash object according to what the screen can fit. I don't do a lot of Javascript, so I could be making an obvious mistake.
Here is the source.
Now, when I load the page, it gives me an error, saying that
. But it gives me no error for 'obj'. So I guess EMBED can't have an ID?
Is there a better approach that I should take instead?
Here is the source.
Code:
<OBJECT id="flashobj" WIDTH=400 HEIGHT=400>
<PARAM NAME=movie VALUE="flashfil.swf">
<EMBED id="flashembed" src="/images/pandora.swf" WIDTH=400 HEIGHT=400 TYPE="application/x-shockwave-flash"></EMBED>
</OBJECT>
<script language=JavaScript>
var flashwidth = (window.screen.availHeight*0.8);
obj = document.getElementById('flashobj');
obj.WIDTH = flashwidth;
obj.HEIGHT = flashwidth;
emb = document.getElementById('flashembed');
emb.WIDTH = flashwidth;
emb.HEIGHT = flashwidth;
</script>
Now, when I load the page, it gives me an error, saying that
Code:
'emb' is null
Is there a better approach that I should take instead?