Flash Movie. Not knowing dimensions.

24 views
Skip to first unread message

Shapper

unread,
Oct 20, 2011, 10:39:42 AM10/20/11
to swfo...@googlegroups.com
Hello,

I have a DIV with 470px.
I need to display the Flash object in this DIV.
I don't know the width or height of the Flash movie.

My idea would be:

1 - If the Flash movie width is less than 470px then:
     Display the Flash movie with the original dimensions.

2 - If the Flash movie width is greater than 470px then:
     Scale the width to 470px and keep proportion with height.

I have been trying a few changes in width and height (px, %, ...).

However, usually the Flash movie disappears ...

Thank You,
Miguel



Aran Rhee

unread,
Oct 20, 2011, 11:34:24 AM10/20/11
to swfo...@googlegroups.com
Hi Miguel.

See FAQ #1 and the examples there on how to get a 100% swf displaying on all browsers (the example make the swf encompass the whole screen, but the theory is the same in regards to the css required to get it to display in FF etc)

http://code.google.com/p/swfobject/wiki/faq

Basically, set a css value for height as 100% for the div you will be replacing with the swf file and set your swf w/h = 100% as well. Set the fixed css w/h of the 470px on a parent div:


<html>
<head>
<style type="text/css" media="screen">
#parent { width:470px; height:470px; }
#myContent { height:100%; }
#myAlternativeContent { /* style alt content */ }
</style>
<script type="text/javascript" src="http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test6.swf", "myContent", "100%", "100%", "9.0.0", "expressInstall.swf");
</script>
</head>
<body>
<div id="parent">
<div id="myContent">
<div id="myAlternativeContent">
Alternative content
</div>
</div>
</div>
</body>
</html>


Cheers,
Aran






--
You received this message because you are subscribed to the Google Groups "SWFObject" group.
To view this discussion on the web visit https://groups.google.com/d/msg/swfobject/-/_xMGTDgP65oJ.
To post to this group, send email to swfo...@googlegroups.com.
To unsubscribe from this group, send email to swfobject+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swfobject?hl=en.

Shapper

unread,
Oct 20, 2011, 4:35:21 PM10/20/11
to swfo...@googlegroups.com
What about the following:

HTML:

<div class="video-wrapper">
    <div class="video-container">
    <div class="Flash">     
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="Flash" class="Flash">   
          <param name="movie" value="Assets/Case/Flash.swf" />
          <param name="play" value="true" />
            <param name="loop" value="true" />
            <param name="menu" value="false" />
            <param name="quality" value="best" />
            <param name="scale" value="exactfit" />
            <param name="wmode" value="transparent" />
            <param name="allowfullscreen" value="false" />
            <param name="allowscriptaccess" value="sameDomain" />           
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="Assets/Case/Flash.swf" class="Flash">           
              <param name="play" value="true" />
              <param name="loop" value="true" />
                <param name="menu" value="false" />
                <param name="quality" value="best" />
                <param name="scale" value="exactfit" />
                <param name="wmode" value="transparent" />
                <param name="allowfullscreen" value="false" />
                <param name="allowscriptaccess" value="sameDomain" />               
              <!--<![endif]-->
          <a href="http://get.adobe.com/flashplayer/">
            <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
          </a>
              <!--[if !IE]>-->
            </object>
            <!--<![endif]-->
        </object>
    </div>
    </div>
</div>

CSS:

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 30px;
    height: 0;
    overflow: hidden;
}

.video-container iframe, 
.video-container object, 
.video-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

It seems to be working fine.

Can I integrate this with SWF Object?

Or does it make sense to integrate this with SWF Object?

Thank You,
Miguel

Aran Rhee

unread,
Oct 23, 2011, 1:23:25 PM10/23/11
to swfo...@googlegroups.com
I am not sure of your question, as this IS swfobject notation (this is the static embed option).... Have a read of the documentation here: http://code.google.com/p/swfobject/wiki/documentation

so that you can understand what the below code is actually doing....


Aran




Thank You,
Miguel

--
You received this message because you are subscribed to the Google Groups "SWFObject" group.
To view this discussion on the web visit https://groups.google.com/d/msg/swfobject/-/4-cXb7VUDtAJ.
Reply all
Reply to author
Forward
0 new messages