Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. parentColor.setTransform(camColor.getTransform());
  2. function camControl() {
  3. parentColor.setTransform(camColor.getTransform());
  4. var scaleX = sX/this._width;
  5. var scaleY = sY/this._height;
  6. _parent._x = cX-(this._x*scaleX);
  7. _parent._y = cY-(this._y*scaleY);
  8. _parent._xscale = 100*scaleX;
  9. _parent._yscale = 100*scaleY;
  10. }
  11. function resetStage() {
  12. var resetTrans = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
  13. parentColor.setTransform(resetTrans);
  14. _parent._xscale = 100;
  15. _parent._yscale = 100;
  16. _parent._x = 0;
  17. _parent._y = 0;
  18. }
  19. // make frame invisible
  20. this._visible = false;
  21. // Capture stage parameters
  22. var oldMode = Stage.scaleMode;
  23. Stage.scaleMode = "exactFit";
  24. var cX = Stage.width/2;
  25. var cY = Stage.height/2;
  26. var sX = Stage.width;
  27. var sY = Stage.height;
  28. Stage.scaleMode = oldMode;
  29. // create color instances for color
  30. // transforms (if any).
  31. var camColor = new Color(this);
  32. var parentColor = new Color(_parent);
  33. // Make the stage move so that the
  34. // v-cam is centered on the
  35. // viewport every frame
  36. this.onEnterFrame = camControl;
  37. // Make an explicit call to the camControl
  38. // function to make sure it also runs on the
  39. // first frame.
  40. camControl();
  41. // If the v-cam is ever removed (unloaded)
  42. // the stage, return the stage to the default
  43. // settings.
  44. this.onUnload = resetStage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement