# Problem getting different frames of video - code attached

**URL:** <https://forum.kirupa.com/t/problem-getting-different-frames-of-video-code-attached/291611>\
**Category:** flash\
**Created:** [July 2, 2009, 8:34am UTC](https://forum.kirupa.com/t/problem-getting-different-frames-of-video-code-attached/291611 "2009-07-02T08:34:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neeraj\_b](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@neeraj\_b](https://forum.kirupa.com/u/neeraj_b)\
**Post date:** [July 2, 2009, 8:34am UTC](https://forum.kirupa.com/t/problem-getting-different-frames-of-video-code-attached/291611/1 "2009-07-02T08:34:18Z")

</div>

Hi,

I need to get random frames of a video on request. I am using bitmapdata.draw(video) for this. But the problem I am facing is that I am not getting the snapshot of the exact frame. The video is there on localhost so I suppose the problem cannot be of Enhanced seek.

What happens is that when I do ns.seek(someTime), the videoContainer displays the required frame but the snapshot is taken according to ns.time ( which is not changing upon ns.seek(someTime)). So, the snapshot is something else and the videoContainer is displaying something else. Wierd!!

[LEFT][COLOR=#993300]function[/COLOR] manageDataCOLOR=#000000[/COLOR]:[COLOR=#993300]void[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#993300]var[/COLOR] frameno:[COLOR=#993300]int[/COLOR]=intCOLOR=#000000[/COLOR];  
[COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]"frame requested \>\> "[/COLOR] + frameno\*vidDuration/vidTotalframes[COLOR=#000000])[/COLOR];

[COLOR=#993300]var[/COLOR] bmd:BitmapData=[COLOR=#993300]new[/COLOR] BitmapDataCOLOR=#000000[/COLOR];  
[COLOR=#993300]var[/COLOR] scale1:[COLOR=#993300]Number[/COLOR]=vidWidth/videoContainer.[COLOR=#993300]width[/COLOR];  
[COLOR=#993300]var[/COLOR] scale2:[COLOR=#993300]Number[/COLOR]=vidHeight/videoContainer.[COLOR=#993300]height[/COLOR];  
[COLOR=#993300]var[/COLOR] myMatrix:Matrix = [COLOR=#993300]new[/COLOR] MatrixCOLOR=#000000[/COLOR];  
myMatrix.[COLOR=#000000]scale[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]"the time is \>\> "[/COLOR] + ns.[COLOR=#993300]time[/COLOR][COLOR=#000000])[/COLOR];  
ns.[COLOR=#993300]pause[/COLOR]COLOR=#000000[/COLOR];  
ns.[COLOR=#993300]seek[/COLOR]COLOR=#000000[/COLOR];  
bmd.[COLOR=#000000]draw[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]var[/COLOR] bitmap:Bitmap=[COLOR=#993300]new[/COLOR] BitmapCOLOR=#000000[/COLOR];  
[COLOR=#993300]var[/COLOR] sampleMc:[COLOR=#993300]MovieClip[/COLOR]=[COLOR=#993300]new[/COLOR] [COLOR=#993300]MovieClip[/COLOR]COLOR=#000000[/COLOR];  
sampleMc.[COLOR=#000000]addChild[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]this[/COLOR].[COLOR=#000000]addChild[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]
