snaxxtrickster

ActionScript 3.0 V-Cam code

Apr 4th, 2022 (edited)
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* HOW TO GET THIS SHIT UP AND RUNNING
  2. a smol guide by midgetsausage. no I didn't write this code
  3.  
  4. 1. Make a 1920x1080 rectangle. If you want a 4:3 V-Cam, type in 1440 instead of 1920.
  5. 2. Make it a Movie Clip symbol with the registration/anchor point in the center.
  6. 3. Go in the newly made symbol by double-clicking it, and make a new layer in it.
  7. 4. Click the frame of the new layer, and hit F9 to bring up the Actions panel.
  8. 5. Copy paste below code into Actions panel.
  9. 6. Voila. Exit the symbol and use it as you wish.
  10.  
  11. Alan Becker made a similar guide here, years prior. He also goes into detail on how to actually use the thing.
  12. https://www.youtube.com/watch?v=Np2LXXk-uHw
  13. */
  14.  
  15. var cameraTrans:Transform = new Transform(this);
  16. var stageTrans:Transform = new Transform(parent);
  17. visible = false;
  18.  
  19. stage.addEventListener(Event.ENTER_FRAME, updateStage);
  20. function updateStage(...rest) {
  21.  parent.filters = filters;
  22.  stageTrans.colorTransform = cameraTrans.colorTransform;
  23.  var stageMatrix:Matrix = cameraTrans.matrix;
  24.  stageMatrix.invert();
  25.  stageMatrix.translate(stage.stageWidth*.5, stage.stageHeight*.5);
  26.  stageTrans.matrix = stageMatrix;
  27. };
  28. updateStage();
  29.  
  30. addEventListener(Event.REMOVED_FROM_STAGE, resetStage);
  31. function resetStage(...rest) {
  32.  stage.removeEventListener(Event.ENTER_FRAME, updateStage);
  33.  stageTrans.matrix = new Matrix();
  34.  stageTrans.colorTransform = new ColorTransform();
  35.  parent.filters = new Array();
  36. }
Add Comment
Please, Sign In to add comment