Movieclip doesn't stay on timeline past 2nd frame. Help!

  • fingersox
  • Born
  • Born
  • fingersox
  • Posts: 3

Post 3+ Months Ago

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! :shock: :hmm: 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 :)

Code: [ Select ]
/* 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());
}
  1. /* capture the video stream from the active webcam and display it inside the video object */
  2. output_vid.attachVideo(Camera.get());
  3. import flash.display.BitmapData
  4. import flash.geom.Matrix
  5. /*
  6. create a new bitmap object that is the same size
  7. as the Video object to store the pixel data
  8. */
  9. var snapshot:BitmapData=new BitmapData(160,120);
  10. /*
  11. create a function that takes a snapshot
  12. of the Video object whenever it is called
  13. */
  14. function takeSnapshot()
  15. {
  16. //draw the current state of the Video object into
  17. //the bitmap object with no transformations applied
  18. snapshot.draw(output_vid,new Matrix());
  19. }
  20. //create a movie clip to hold the bitmap when we attach it
  21. this.createEmptyMovieClip("bitmap_mc",this.getNextHighestDepth());
  22. //display the specified bitmap object inside the movie clip
  23. bitmap_mc.attachBitmap(snapshot,1);
  24. //position on screen
  25. bitmap_mc._x = 175;
  26. bitmap_mc._y = 350;
  27. bitmap_mc._xscale = 100;
  28. bitmap_mc._yscale = 110;
  29. snap_btn.onPress = function (){
  30.     takeSnapshot();
  31.     //var snapshot:BitmapData=new BitmapData(160,120);
  32.     //snapshot.draw(output_vid,new Matrix());
  33. }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • CStrauss
  • Graduate
  • Graduate
  • User avatar
  • Posts: 122
  • Loc: St. Louis MO. USA

Post 3+ Months Ago

I haven't done anything like this yet but I remember seeing a tutorial about something like this and AIR on http://gotoandlearn.com there are a few video tutorials on this subject I believe.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.