2 Replies Latest reply on Jan 21, 2011 3:47 AM by longo69115

    Is it possible to generate a Screenshot from VideoDisplay Component?

    longo69115

      Hi Everybody,

       

      Is there a way to generate a screenshot from a video which is played in the VideoDisplay Component? We want to show a video and put some buttons over it after it is finished. That it all look good, we thought about the last frame from the video as a background image. Any suggestions? Or maybe waiting for Flash Builder 5?!

        • 1. Re: Is it possible to generate a Screenshot from VideoDisplay Component?
          MDubbs

           

          Call this function with your component and use the returned image.

           

          private function generateBitmap(component:UIComponent):Image {

           

          var width:Number = component.width;

           

          var height:Number = component.height;

           

          var bitmapData:BitmapData = new BitmapData(width, height, true, 0);

          bitmapData.draw(component);

           

           

          var image:Image = new Image();

          image.source = bitmapData;

          image.setActualSize(width, height);

          image.includeInLayout =

          false;

          image.cacheAsBitmap =

          true;

           

          image.x = component.x;

          image.y = component.y;

          image.alpha = component.alpha;

           

           

          return image;

          }

          1 person found this helpful
          • 2. Re: Is it possible to generate a Screenshot from VideoDisplay Component?
            longo69115 Level 1

            Hi MDubbs,

             

            I tried your code, but it didn't work for me. The source from the *var image* was always [object BitmapData].

             

            I checked around and found the ImageSnapshot and the BitmapDrawable class which are made for that purpose.

             

            private function generateBackgroundImage(comp:IBitmapDrawable):void

            {

                 var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(comp);

                 var array:ByteArray = imageSnap.data as ByteArray;

                 AnswerBackgroundImage.source = array;      //Image-Component of the application

             

            }

             

            This works, but it takes some time (1-2sec). Was your solution faster?