Click to See Complete Forum and Search --> : image


solomon_13000
02-23-2007, 11:42 AM
How do I generate an accurate jpeg thumbnail image from a flv file?

solomon_13000
02-23-2007, 11:27 PM
I found this code an I tried it but it does not seem to work:


var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
myVideo_mc.myVideo_video.attachVideo(stream_ns);

//select an external FLV to play
stream_ns.play("nutrigrain.flv");

//create an instance of the class
//pass the mc to reflect, the opacity of the reflection, the ratio of the gradient mask, and how often to update (milliseconds)
reflect = new Reflect(myVideo_mc, 50, 255, 5);

The Class:

import flash.display.BitmapData;

class Reflect {

private var version:String = "2.0";

private var mcBMP:BitmapData;

private var reflectionBMP:BitmapData;

private var updateInt:Number;



function Reflect(mc:MovieClip, alpha:Number, ratio:Number, updateTime:Number) {

//create a bmp obj out of it

mcBMP = new BitmapData(mc._width, mc._height, true, 0xFFFFFF);

mcBMP.draw(mc);

reflectionBMP = new BitmapData(mc._width, mc._height, true, 0xFFFFFF);

reflectionBMP.draw(mc);

mc.createEmptyMovieClip("reflection_mc", mc.getNextHighestDepth());

mc.reflection_mc.attachBitmap(mcBMP, 1);

mc.reflection_mc._yscale = -100;

mc.reflection_mc._y = mc._height;



//create the gradient mask

mc.createEmptyMovieClip("gradientMask_mc", mc.getNextHighestDepth());

var fillType:String = "linear";

var colors:Array = [0xFFFFFF, 0xFFFFFF];

var alphas:Array = [alpha, 0];

var ratios:Array = [0, ratio];

var matrix = {matrixType:"box", x:0, y:0, w:mc._width, h:mc._height/4, r:(90/180)*Math.PI};

var spreadMethod:String = "pad";

mc.gradientMask_mc.beginGradientFill(fillType, colors, alphas, ratios, matrix, spreadMethod);

mc.gradientMask_mc.moveTo(0, 0);

mc.gradientMask_mc.lineTo(0, mc._height/2);

mc.gradientMask_mc.lineTo(mc._width, mc._height/2);

mc.gradientMask_mc.lineTo(mc._width, 0);

mc.gradientMask_mc.lineTo(0, 0);

mc.gradientMask_mc.endFill();

mc.gradientMask_mc._y = mc._height/2;

mc.reflection_mc.cacheAsBitmap = true;

mc.gradientMask_mc.cacheAsBitmap = true;

mc.reflection_mc.setMask(mc.gradientMask_mc);

updateInt = setInterval(this, "update", updateTime, mc);


}

private function update(mc):Void{

mcBMP.draw(mc);

reflectionBMP.draw(mc);

mc.reflection_mc.attachBitmap(mcBMP, 1);

}

}

solomon_13000
02-23-2007, 11:35 PM
The part I am confuse is:

myVideo_mc.myVideo_video.attachVideo(stream_ns);

Is myVideo_mc - FLVPlayback component. myVideo_video Represents?