swf height and width

  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

I am working width a friend making a flash games website - however I did not relise that flash games come in different sizes now my problem is, how do i get the width and height of the swf and use the values to display the flash game if you do not set values (I tried this assuming it would set its self) it loads way to small.
Here is the code for my game page on the site
Code: [ Select ]
<?php
$string = $game;
$pattern = '(-)';
$replacement = ' ';
$gamespace = preg_replace($pattern, $replacement, $string);
?>
<script>
flashObject = document.getElementById('clsid:D27CDB6E-AE6D-11cf-96B8-444553540000');
flashwidth = flashObject.width;
flashheight = flashObject.height;
</script>
<h1><?php print $gamespace ?></h1>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
width="<script>document.write.flashwidth</script>" height="<script>document.write.flashheight</script>" align="middle">
<param name="movie" value="assets/games/<?php print $game.".swf" ?>">
<param name="quality" value="high">
<param name="bgcolor" value="#F17C1F">
<embed src="assets/games/<?php print $game.".swf" ?>" quality="high" bgcolor="#F17C1F" width="<script>document.write.flashwidth</script>" height="<script>document.write.flashheight</script>" align="middle"
type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></embed>
</object>
<h2>Tell the world about <?php print $gamespace ?>!</h2>
Game URL: <span class="mono">siteurl.com/play/<?php print $game ?></span>
  1. <?php
  2. $string = $game;
  3. $pattern = '(-)';
  4. $replacement = ' ';
  5. $gamespace = preg_replace($pattern, $replacement, $string);
  6. ?>
  7. <script>
  8. flashObject = document.getElementById('clsid:D27CDB6E-AE6D-11cf-96B8-444553540000');
  9. flashwidth = flashObject.width;
  10. flashheight = flashObject.height;
  11. </script>
  12. <h1><?php print $gamespace ?></h1>
  13. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  14. codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
  15. width="<script>document.write.flashwidth</script>" height="<script>document.write.flashheight</script>" align="middle">
  16. <param name="movie" value="assets/games/<?php print $game.".swf" ?>">
  17. <param name="quality" value="high">
  18. <param name="bgcolor" value="#F17C1F">
  19. <embed src="assets/games/<?php print $game.".swf" ?>" quality="high" bgcolor="#F17C1F" width="<script>document.write.flashwidth</script>" height="<script>document.write.flashheight</script>" align="middle"
  20. type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></embed>
  21. </object>
  22. <h2>Tell the world about <?php print $gamespace ?>!</h2>
  23. Game URL: <span class="mono">siteurl.com/play/<?php print $game ?></span>

also not sure why you have to set the values of eventing 2 times but this a sided query
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • suzie
  • Guru
  • Guru
  • User avatar
  • Posts: 1134
  • Loc: England

Post 3+ Months Ago

With the programe I use (best not to mention (begins with S ends in h)
:mrgreen: :mrgreen:

We have the option of editing the HTML before export, maybe if you have the same option you can edit the swf there too.

Someone said by PHP


WIDTH=<? echo $width;?> HEIGHT=<? echo $height;?>

But at the very least some Flash guru will see this and add to it.
  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

I don't own the games someone else made them I just host them you know like newgrounds.
So I can't edit the height and width.

Using PHP might work but where would I get the values for $WIDTH and $HEIGHT from I don't real want to use a DB

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 82 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.