Reputation: 3828
Is there a way to allow the stage to fit to the entire screen of the browser but keep the objects in the middle and not scale them?
My code below works with the stage scale but my character is also getting scaled. How can I make him independent and not affected by the screen size and with?
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;
}
HERE IS MY 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>
Upvotes: 0
Views: 5365
Reputation: 39458
You need to use NO_SCALE
on the stage
. That is all.
stage.scaleMode = StageScaleMode.NO_SCALE;
Remove:
my_mc.scaleMode = StageScaleMode.NO_SCALE;
Upvotes: 1