Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

fullScreen problem

Engaged ,
Sep 12, 2012 Sep 12, 2012

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:

error.jpg

TOPICS
ActionScript
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 14, 2012 Sep 14, 2012

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

...
Translate
LEGEND ,
Sep 12, 2012 Sep 12, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 12, 2012 Sep 12, 2012

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;

          }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 14, 2012 Sep 14, 2012

i tried but not solve my problem.

this is my file.

can u please check it once..

http://www.mediafire.com/?8tb4mfr0xf87iza

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2012 Sep 14, 2012

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...

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 14, 2012 Sep 14, 2012

ok, Thankyou.....


sinious

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 17, 2012 Sep 17, 2012

You're welcome and good luck!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 18, 2012 Sep 18, 2012
LATEST

Thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2012 Sep 12, 2012

What code are you using for the x/y placement of the video player?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines