简体   繁体   English

将Flash div调整为完整的浏览器高度和宽度?

[英]resize flash div to full browser height and width?

i have a page with swf flash flash with width 300x250 我的页面有swf闪光灯,宽度为300x250

<div id="flashswf"> ...some flash </div>
<div id="maxme">full screen</div>

i have a link called full screen and i need to maximize the flashswf div to fit the current browser maximum height and width 我有一个名为全屏的链接,我需要最大化flashswf div以适应当前浏览器的最大高度和宽度

is this possible using jquery ? 这有可能使用jquery吗? any ideas plz 任何想法PLZ

Use 采用

$(window).width();

and

$(window).height();

to get the window width and height 获得窗口的宽度和高度

$(function() {
    $("#maxme").click ( function() {
        $("#flashswf").width($(window).width());
        $("#flashswf").height($(window).height());
    });
});

See width() and height() 请参见width()height()

$( '#flashswf' ).css( { 
     'width': $( window ).width() + 'px', 
     'height': $( window ).height() + 'px'
} );

I believe part of what you need is to set the stage.scaleMode = StageScaleMode.NO_SCALE . 我相信你需要的部分是设置stage.scaleMode = StageScaleMode.NO_SCALE Otherwise Flash attempts to maintain the settings from the SWF file. 否则,Flash会尝试从SWF文件维护设置。 See the documentation for more info. 有关详细信息,请参阅文档

I grabbed this example code from Adobe : 从Adobe获取了这个示例代码

import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

var swfStage:Stage = videoScreen.stage;
swfStage.scaleMode = StageScaleMode.NO_SCALE;
swfStage.align = StageAlign.TOP_LEFT;

function resizeDisplay(event:Event):void
{
    var swfWidth:int = swfStage.stageWidth;
    var swfHeight:int = swfStage.stageHeight;

    // Resize the video window.
    var newVideoHeight:Number = swfHeight - controlBar.height;
    videoScreen.height = newVideoHeight;
    videoScreen.scaleX = videoScreen.scaleY;

    // Reposition the control bar.
    controlBar.y = newVideoHeight;
}

swfStage.addEventListener(Event.RESIZE, resizeDisplay);

It's possible, but note that browser resets the Flash application if the style of the element containing it (or any parent element) is changed. 这是可能的,但请注意,如果更改包含它的元素(或任何父元素)的样式,浏览器将重置Flash应用程序。

If you need to maintain the state of the application, you can, for example, put it in the middle of a 3x3 table with 100% width and height, and then manipulate styles of all other cells. 如果您需要维护应用程序的状态,例如,您可以将其放在具有100%宽度和高度的3x3表格的中间,然后操纵所有其他单元格的样式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM