V-Cam Tutorial - Adobe CS4/CS5 Flash Pro
V-Cam action script:
function camControl()
{
parentColor.setTransform(camColor.getTransform());
var _l4 = sX / this._width;
var _l3 = sY / this._height;
_parent._x = cX - this._x * _l4;
_parent._y = cY - this._y * _l3;
_parent._xscale = 100 * _l4;
_parent._yscale = 100 * _l3;
} // End of the function
function resetStage()
{
var _l2 = {ra: 100, rb: 0, ga: 100, gb: 0, ba: 100, bb: 0, aa: 100, ab: 0};
parentColor.setTransform(_l2);
_parent._xscale = 100;
_parent._yscale = 100;
_parent._x = 0;
_parent._y = 0;
} // End of the function
this._visible = false;
var oldMode = Stage.scaleMode;
Stage.scaleMode = "exactFit";
var cX = Stage.width / 2;
var cY = Stage.height / 2;
var sX = Stage.width;
var sY = Stage.height;
Stage.scaleMode = oldMode;
var camColor = new Color(this);
var parentColor = new Color(_parent);
this.onEnterFrame = camControl;
this.onUnload = resetStage;