开发者

Resize Flash with Javascript?

开发者 https://www.devze.com 2023-03-07 07:37 出处:网络
I\'m wondering if its possible to resize flash with javascript. I can\'t change any code in the flash object alone all I have is html, javascript and php to work with.

I'm wondering if its possible to resize flash with javascript. I can't change any code in the flash object alone all I have is html, javascript and php to work with.

Heres what I've found so far:

    var changeMe = document.getElementById("content_embed");
  changeMe.height = yy;
  changeMe.width = xx;
  if (navigator.userAgent.toLowerCase().indexOf("safari")!=-1开发者_如何学运维) {
    var changemeObject = document.getElementById("content_object");
    changeMeObject.height = yy;
    changeMeObject.width = xx;
  }
}

Content Embed is the embed tag and content object is the object tag in the flash. This works in chrome (and probably firefox) but not ie. In internet explorer I get the error: Unable to set value of the property 'height': object is null or undefined

Here is the example page I have been using:http://futuregamespc.com/behind/Popup/ Can anyone help? Thanks guys, you're what makes this site awesome.


Yes it is possible.

But, please use swfobject whenever you display flash in your website.

Its a lightweight JavaScript library that allows you to integrate swf in a cross browser friendly way to your website.

The below given is a sample of the call to swfobject

var flashvars = {};
var params = {};
var attributes = {};
var width="300";
var height="120";

swfobject.embedSWF("myContent.swf", "myContent", width, height, "9.0.0","expressInstall.swf", flashvars, params, attributes);

As you can see, height and width are passed are parameters.
Read swfobject documentation for more details.

Update: Here is another good write up on using swfobject on the Adobe site itself.

0

精彩评论

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