I have a background movie clip (bg_mc) and a FLV Player (FLVPlayer) that I want to use in a full browser flash. Everything is working except that the FLVPlayer is aligning itself by the Top Left, when you look at the attached pic you can see that the alignment circle is in the center. When I adjust the browser size everything adjusts as it should even the FLVPlayer, but the Player is adjusting itself to the TopLeft...so most of the Player is out of the screen.
Can anyone assist?
Here is my ActionScript:
Actionscript Code:
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);
//function to handle background image resize.
function setBackground() {
var reg2 = stage.stageWidth / 2;
var reg1 = stage.stageHeight / 2;
bg_mc.x = reg2;
bg_mc.y = reg1;
bg_mc.width = stage.stageWidth;
bg_mc.height = stage.stageHeight;
bg_mc.scaleX <= bg_mc.scaleY ? (bg_mc.scaleX = bg_mc.scaleY) : (bg_mc.scaleY = bg_mc.scaleX);
}
setBackground();
//set intitial position
function setPos() {
FLVPlayer.x = stage.stageWidth / 2;
FLVPlayer.y = stage.stageHeight / 2;
}
setPos();
//set position when stage resizes
function resizeHandler(event:Event):void {
setBackground();
setPos();
}