PDA

View Full Version : SWFObject 2.0



ggalan
02-21-2010, 12:42 PM
hello, in the previous version of swfobject i was able to adjust my flash file according to the screen size like this


<script type="text/javascript">
var screen_height = screen.height;
if (screen_height >= 850) {
var so = new SWFObject("swf/main.swf", "main", "1024", "768", "8", "#ffffff");
}else if (screen_height <= 849 && screen_height >= 0) {
var so = new SWFObject("swf/main.swf", "main", "768", "576", "8", "#ffffff");
}
so.write("flashcontent");<!--75% of the original-->
</script>


but how can i express this in the new SWFObject 2.0


<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {id:"flashcontent"};
swfobject.embedSWF("swf/main.swf", "flashcontent", "1024", "768", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
</script>

ggalan
02-21-2010, 01:13 PM
well, i got lucky and figured out most of it


<script type="text/javascript">
var flashvars = { };

var attributes = {id:"flashcontent"};
<!--swfobject.embedSWF("swf/main.swf", "flashcontent", "980", "750", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);-->

var screen_height = screen.height;
if (screen_height >= 769) {
var params = {wmode:"Transparent", scale:"noscale", quality:"high", bgcolor:"#000000", allowscriptaccess:"samedomain", allowfullscreen:"true"};
var so = new swfobject.embedSWF("swf/main_mc.swf", "flashcontent", "980", "750", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
}else if (screen_height <= 768 && screen_height >= 0) {
var params = {wmode:"Transparent", quality:"high", bgcolor:"#000000", allowscriptaccess:"samedomain", allowfullscreen:"true"};
var so = new swfobject.embedSWF("swf/main.swf", "flashcontent", "735", "563", "9.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
}
so.swfobject.embedSWF("flashcontent");

</script>


but i have a video inside and when it goes to full screen, the settings are screwy