Hi,
I'm making a project whereby a user can take a snapshot of themselves. This still bitmap is then used as part of an animation. When some elements of the animation hit the bitmap, the bitmap alters in some way (e.g - changes sizes). I'm familiar with how to do hit-tests, so this is not a problem.
However, my issue is getting the bitmap to stay on the timeline past the second frame!

The animation needs to start running on the second frame (or so I currently think) but when this happens, the bitmap disappears.
Does anyone know a way for the bitmap to actually remain on the timeline throughout the animation? I'm hoping the bitmap won't have to be stored on some kind of database because I'm worried about space, although if the bitmap isn't permanently stored then this solution would be fine (would still require some advice on how to do this though).
I have included my code at the bottom. This section works. I've played with adding an animation mc with hit-test code on it that collides with the bitmap on the second frame but the bitmap disappears every time.
I'd really appreciate some help on this issue. Thanks in advance
/* capture the video stream from the active webcam and display it inside the video object */
output_vid.attachVideo(Camera.get());
import flash.display.BitmapData
import flash.geom.Matrix
/*
create a new bitmap object that is the same size
as the Video object to store the pixel data
*/
var snapshot:BitmapData=new BitmapData(160,120);
/*
create a function that takes a snapshot
of the Video object whenever it is called
*/
function takeSnapshot()
{
//draw the current state of the Video object into
//the bitmap object with no transformations applied
snapshot.draw(output_vid,new Matrix());
}
//create a movie clip to hold the bitmap when we attach it
this.createEmptyMovieClip("bitmap_mc",this.getNextHighestDepth());
//display the specified bitmap object inside the movie clip
bitmap_mc.attachBitmap(snapshot,1);
//position on screen
bitmap_mc._x = 175;
bitmap_mc._y = 350;
bitmap_mc._xscale = 100;
bitmap_mc._yscale = 110;
snap_btn.onPress = function (){
takeSnapshot();
//var snapshot:BitmapData=new BitmapData(160,120);
//snapshot.draw(output_vid,new Matrix());
}
- /* capture the video stream from the active webcam and display it inside the video object */
- output_vid.attachVideo(Camera.get());
- import flash.display.BitmapData
- import flash.geom.Matrix
- /*
- create a new bitmap object that is the same size
- as the Video object to store the pixel data
- */
- var snapshot:BitmapData=new BitmapData(160,120);
- /*
- create a function that takes a snapshot
- of the Video object whenever it is called
- */
- function takeSnapshot()
- {
- //draw the current state of the Video object into
- //the bitmap object with no transformations applied
- snapshot.draw(output_vid,new Matrix());
- }
- //create a movie clip to hold the bitmap when we attach it
- this.createEmptyMovieClip("bitmap_mc",this.getNextHighestDepth());
- //display the specified bitmap object inside the movie clip
- bitmap_mc.attachBitmap(snapshot,1);
- //position on screen
- bitmap_mc._x = 175;
- bitmap_mc._y = 350;
- bitmap_mc._xscale = 100;
- bitmap_mc._yscale = 110;
- snap_btn.onPress = function (){
- takeSnapshot();
- //var snapshot:BitmapData=new BitmapData(160,120);
- //snapshot.draw(output_vid,new Matrix());
- }