Copy link to clipboard
Copied
I'm calling swf file (video player) through URL Loader. all controls are fine.
but i facing problem at fullscreen mode.
*my player is into a movieClip called as content_mc .
*that movieClip registration point is middle.
how can i solve this problem without changing registration point?
problem:

On your first frame script update the y position of the contentBox like you are the x position:
function updateSize(e:Event)
{
//Set background's size
backgroundMC.width = stage.stageWidth;
backgroundMC.height = stage.stageHeight;
contentBox.x = stage.stageWidth/2;
contentBox.y = stage.stageHeight/2;
}
Inside the contentBox frame script you use the stage's dimensions rather than the videos:
...
if (e.fullScreen)
{
pLoader.x = int(stage.stageWidth/2)*-1;
pLoader.y = int(stage.stageHeig
Copy link to clipboard
Copied
Center registration often requires positioning with negative x/y values.
Just calculate the size of the video player and divide its height and width by 2 (half). The number you get is the amount you need to move into the negative. To negate the number just multiply it by -1.
e.g.
videoPlayerMC.x = int(videoPlayerMC.width / 2) * -1;
videoPlayerMC.y = int(videoPlayerMC.height / 2) * -1;
If your videoPlayerMC was 640 width, 480 height then the numbers returned would be x = -320, y = -240. I wrapped it in int() casting to make sure it's a whole pixel with no fraction.
There's other ways but this is most verbose and easiest to understand.
Copy link to clipboard
Copied
Above method not working for my code.
my player is 4:3 .
*player is in a movieClip (white box in above image)*
Video Player swf code:
//==================FullScreen SetUp ========================
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
function onFullscreen(e:FullScreenEvent):void
{
if (e.fullScreen)
{
controlBar.fullscreen_btn.visible = false;
controlBar.normal_btn.visible = true;
controlBar.x = (Capabilities.screenResolutionX - 480) / 2;
controlBar.y = (Capabilities.screenResolutionY - 116);
mid_play.x = stage.stageWidth / 2;
mid_play.y = stage.stageHeight / 2;
vidDisplay.height = (Capabilities.screenResolutionY);
vidDisplay.width = vidDisplay.height * 4 / 3;
vidDisplay.x= (Capabilities.screenResolutionX - vidDisplay.width) / 2;
}
else
{
controlBar.fullscreen_btn.visible = true;
controlBar.normal_btn.visible = false;
controlBar.x = 0;
controlBar.y = 244;
vidDisplay.y = 0;
vidDisplay.x = 0;
vidDisplay.width = 480;
vidDisplay.height = 360;
}
}
This is present working file code:
var eventPlayer:String = "videoplayer.swf";
var pLoader:Loader = new Loader();
var pRequest:URLRequest = new URLRequest(eventPlayer);
pLoader.load(pRequest);
addChild(pLoader);
pLoader.x = -405;
pLoader.y = -78;
stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullscreen);
function onFullscreen(e:FullScreenEvent):void
{
if (e.fullScreen)
{
//pLoader.x = 0;
//pLoader.y = 0;
pLoader.x = int(pLoader.width/2)*-1;
pLoader.y = int(pLoader.height/2)*-1;
}
else
{
pLoader.x = -405;
pLoader.y = -78;
}
}
Copy link to clipboard
Copied
i tried but not solve my problem.
this is my file.
can u please check it once..
Copy link to clipboard
Copied
On your first frame script update the y position of the contentBox like you are the x position:
function updateSize(e:Event)
{
//Set background's size
backgroundMC.width = stage.stageWidth;
backgroundMC.height = stage.stageHeight;
contentBox.x = stage.stageWidth/2;
contentBox.y = stage.stageHeight/2;
}
Inside the contentBox frame script you use the stage's dimensions rather than the videos:
if (e.fullScreen)
{
pLoader.x = int(stage.stageWidth/2)*-1;
pLoader.y = int(stage.stageHeight/2)*-1;
// rest...
}
Copy link to clipboard
Copied
ok, Thankyou.....
Copy link to clipboard
Copied
You're welcome and good luck!
Copy link to clipboard
Copied
Thank you
Copy link to clipboard
Copied
What code are you using for the x/y placement of the video player?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more