as3 Scale Stage但不满足

时间:2012-06-06 00:38:10

标签: actionscript-3 flash scale

有没有办法让舞台适合浏览器的整个屏幕,但是将对象保留在中间而不是缩放它们?

我的代码适用于舞台比例,但我的角色也会缩放。如何让他独立,不受屏幕尺寸和影响?感谢

import flash.display.StageAlign;
import flash.display.StageScaleMode;



import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.*;
import flash.media.Sound;
import flash.media.SoundChannel;
////////////////////////////////////

stage.scaleMode = StageScaleMode.EXACT_FIT;
stage.align = StageAlign.TOP_LEFT;

var ScreenY = flash.system.Capabilities.screenResolutionY;
var ScreenX = flash.system.Capabilities.screenResolutionX;





blueBG.width = ScreenX;
blueBG.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);

var Beau:Loader = new Loader();
Beau.load(new URLRequest("/Beau.swf"));
Beau.contentLoaderInfo.addEventListener(Event.COMPLETE, loadBG);
function loadBG(e:Event):void
{


}


//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad:Boolean = true;

function fl_ClickToLoadUnloadSWF(event:MouseEvent):void
{
    if(fl_ToLoad)
    {
        var my_mc:MovieClip = new MovieClip(); 
         addChild(my_mc);
        my_mc.addChild(Beau);
        my_mc.scaleMode = StageScaleMode.NO_SCALE;
        var ED = ScreenY /2;
        Beau.height = ED;
        Beau.scaleX = Beau.scaleY;
        Beau.y = 0;


    }
    else
    {
        Beau.unload();
        removeChild(Beau);
        Beau = null;
        blueBG.alpha = 0;
    }
    // Toggle whether you want to load or unload the SWF
    fl_ToLoad = !fl_ToLoad;
}

这是我的HTML:

<div id="flashContent">
            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%" id="BeauFillScreen" align="middle">
                <param name="movie" value="BeauFillScreen.swf" />
                <param name="quality" value="best" />
                <param name="bgcolor" value="#ffffff" />
                <param name="play" value="true" />
                <param name="loop" value="true" />
                <param name="wmode" value="transparent" />
                <param name="scale" value="noscale" />
                <param name="menu" value="true" />
                <param name="devicefont" value="false" />
                <param name="salign" value="" />
                <param name="allowScriptAccess" value="sameDomain" />
                <!--[if !IE]>-->
                <object type="application/x-shockwave-flash" data="BeauFillScreen.swf" width="100%" height="100%">
                    <param name="movie" value="BeauFillScreen.swf" />
                    <param name="quality" value="best" />
                    <param name="bgcolor" value="#ffffff" />
                    <param name="play" value="true" />
                    <param name="loop" value="true" />
                    <param name="wmode" value="transparent" />
                    <param name="scale" value="noscale" />
                    <param name="menu" value="true" />
                    <param name="devicefont" value="false" />
                    <param name="salign" value="" />
                    <param name="allowScriptAccess" value="sameDomain" />
                <!--<![endif]-->
                    <a href="http://www.adobe.com/go/getflash">
                        <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>

1 个答案:

答案 0 :(得分:1)

您需要在NO_SCALE上使用stage。就是这样。

stage.scaleMode = StageScaleMode.NO_SCALE;

卸下:

my_mc.scaleMode = StageScaleMode.NO_SCALE;