Skip to main content
Participating Frequently
August 5, 2010
Question

AS2 code for button to make media display component fullscreen

  • August 5, 2010
  • 1 reply
  • 1954 views

Hi,

I am using a media display component to display a short FLV cartoon.  I have given the component the instance name "fcEp01" and am successfully controlling its play, rewind and pause functions using buttons using "on (release) {_root.fcEp01.Play();}" and so on.

I want to have an additional button that will allow the viewer to toggle the component to fullscreen (and back).  I am using AS2 in Flash CS3.

I realise that it may be necessary to use a movie clip instead of a regular button, but the tutes I've looked at haven't worked.

Any advice gratefully received.

Thanks.

Daftoons

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 5, 2010

you'll need to

1.  resize your component to the stage's size,

2.  change the stage's displayState property to fullScreen and

3.  make sure your publish settings allow fullscreen.

DaftoonsAuthor
Participating Frequently
August 6, 2010

Hi kglad,

I can't resize the component to the full stage size as it is just one of many things on the stage.  It occupies the top left-hand quarter of the stage (roughly) with other un-related navigation buttons and text boxes around it. (see picture).

I don't need the skin to grow, just the component that holds the FLV.  Is there a simple bit of code I might add to the "bigger" button to achieve this?

Thanks.

DaftoonsAuthor
Participating Frequently
August 6, 2010

you would use something like:

btn.onRelease=function(){
    Stage.displayState = "fullScreen";
    mpb.displayFull();  // where mpb is your mediaplayback component
}


Hi kglad,

Great.  Some real progress made.  I've used your suggested code as follows:

fullscreen_btn.onRelease=function(){
Stage.displayState = "fullScreen";
_root.fcEp01.displayFull();

}

What I'm getting now is the whole swf going fullscreen when the button is pressed - not just the component.  I tried it without the last line of code and it worked just the same, so that line seems like it's not working.  I tried using "MediaDisplay.displayState = "fullScreen" in place of "Stage...", but no joy.

I can see that what I might need to do is what I now think you might have been suggesting at the beginning - ie; create a new frame and make the component full stage size.  The button can then send the playhead to frame 2 on resize along the lines of:-

fullscreen_btn.onRelease=function(){

_root.gotoAndPlay(2);
Stage.displayState = "fullScreen";

}

That way I can also resize the skin and use the buttons.  Of course, it would be great to have control over the component alone in frame 1, but if all else fails, this would seem like a solution.

If you have any further ideas, they will be gratefully received, but you've certainly helped me find a solution.  Thanks.