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

Is it possible to generate a Screenshot from VideoDisplay Component?

Guest
Jan 20, 2011 Jan 20, 2011

Copy link to clipboard

Copied

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?!

Views

370

Translate

Translate

Report

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
New Here ,
Jan 20, 2011 Jan 20, 2011

Copy link to clipboard

Copied

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;

}

Votes

Translate

Translate

Report

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
Guest
Jan 21, 2011 Jan 21, 2011

Copy link to clipboard

Copied

LATEST

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?

Votes

Translate

Translate

Report

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