开发者

Showing a large amount of HTML alternative content with swfobject & swffit flash site

I have a开发者_开发百科 full flash site which uses swfobject to embed it 100% height and width. I'm using swffit to force a browser scroll bar for pages with a large amount of content. This is all fine and works perfectly. I also have the content in HTML format, as alternative content and this also works apart from in order to get the flash swfobject to work I need to add the overflow = hidden in the CSS, like:

html{
height: 100%;
overflow:hidden; 
}
#content{
height: 100%;
}

This then stops the scroll bar showing when the alternative content is shown. Does anyone know how to fix this?


I don't know SWFFit but why do you need the overflow: hidden in the first place? Won't it work without?

The only workaround that comes to mind is to define two classes, one with, one without overflow: hidden, and change the class of the html element programmatically from within Flash by triggering some Javascript.


If you need to change a page's CSS or content based on the success of a SWFObject embed, use the callback function feature in SWFObject 2.2.

For dynamic publishing, it looks like this:

var flashvars = {};
var params = {};
var attributes = {};
var embedHandler = function (e){
};

swfobject.embedSWF("mymovie.swf", "targetID", "550", "400", "9.0.0", "expressInstall.swf", flashvars, params, attributes, embedHandler);

In your situation, if you needed to remove overflow:hidden from the HTML element, you could do this:

var flashvars = {};
var params = {};
var attributes = {};
var embedHandler = function (e){
   //If embed fails
   if(!e.success){
      document.getElementsByTagName("html")[0].style.overflow = "auto";
   }
};

swfobject.embedSWF("mymovie.swf", "targetID", "550", "400", "9.0.0", "expressInstall.swf", flashvars, params, attributes, embedHandler);

This callback function feature is only available in SWFObject 2.2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜