6 Replies Latest reply on Aug 6, 2010 10:20 AM by Daftoons

    AS2 code for button to make media display component fullscreen

    Daftoons Level 1

      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

        • 1. Re: AS2 code for button to make media display component fullscreen
          kglad Adobe Community Professional & MVP

          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.

          1 person found this helpful
          • 2. Re: AS2 code for button to make media display component fullscreen
            Daftoons Level 1

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

             

             

             

            fc_home.jpg

            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.

            • 3. Re: AS2 code for button to make media display component fullscreen
              kglad Adobe Community Professional & MVP

              why can't you resize your component when going fullscreen?

              • 4. Re: AS2 code for button to make media display component fullscreen
                Daftoons Level 1

                Hi kglad,

                 

                Sorry, I didn't realise you meant I should resize it when going full screen.  I thought you meant I should start off with the component full stage size and then make the whole swf fullscreen.

                 

                I'm not clear about what you suggest I should do.  I'm starting with the component at its original size with the instance name fcEP01 on a single frame.  I've created a button ready to control it.  That's it so far.  I have removed all the Actionscript attempted so far, so the Actions for the button is completely blank.  What do you think I should do next?

                 

                I am a cartoon animator and am used to working primarily on the timeline with a minimum of AS, so if I'm missing something obvious, I apologise.

                 

                Thanks.

                • 5. Re: AS2 code for button to make media display component fullscreen
                  kglad Adobe Community Professional & MVP

                  you would use something like:

                   

                   

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

                  1 person found this helpful
                  • 6. Re: AS2 code for button to make media display component fullscreen
                    Daftoons Level 1

                    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.