# Need Help on Actionscript Camera

**URL:** <https://forum.kirupa.com/t/need-help-on-actionscript-camera/220050>\
**Category:** flash\
**Created:** [March 22, 2007, 5:12am UTC](https://forum.kirupa.com/t/need-help-on-actionscript-camera/220050 "2007-03-22T05:12:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![the\_inhibitor](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@the\_inhibitor](https://forum.kirupa.com/u/the_inhibitor)\
**Post date:** [March 22, 2007, 5:12am UTC](https://forum.kirupa.com/t/need-help-on-actionscript-camera/220050/1 "2007-03-22T05:12:25Z")

</div>

Im having trouble actionscripting the actionscripted camera (see below) to move to certain locations. I think it might have to do with the fact that it IS the stage so i cant move it using itself. Heres the code (its in the 1st frame in a movieclip thats on the stage):

[COLOR=Navy]function camControl():Void {  
parentColor.setTransform(camColor.getTransform());  
var scaleX:Number = sX/this.\_width;  
var scaleY:Number = sY/this.\_height;  
\_parent.\_x = cX-(this.\_x_scaleX);  
\_parent.\_y = cY-(this.\_y_scaleY);  
\_parent.\_xscale = 100_scaleX;  
\_parent.\_yscale = 100_scaleY;  
}  
function resetStage():Void {  
var resetTrans:Object = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};  
parentColor.setTransform(resetTrans);  
\_parent.\_xscale = 100;  
\_parent.\_yscale = 100;  
\_parent.\_x = 0;  
\_parent.\_y = 0;  
}  
// make frame invisible  
this.\_visible = false;  
// Capture stage parameters  
var oldMode:String = Stage.scaleMode;  
Stage.scaleMode = “exactFit”;  
var cX:Number = Stage.width/2;  
var cY:Number = Stage.height/2;  
var sX:Number = Stage.width;  
var sY:Number = Stage.height;  
Stage.scaleMode = oldMode;  
// create color instances for color  
// transforms (if any).  
var camColor:Color = new Color(this);  
var parentColor:Color = new Color(\_parent);  
// Make the stage move so that the  
// v-cam is centered on the  
// viewport every frame  
this.onEnterFrame = camControl;  
// Make an explicit call to the camControl  
// function to make sure it also runs on the  
// first frame.  
camControl();  
// If the v-cam is ever removed (unloaded)  
// the stage, return the stage to the default  
// settings.  
this.onUnload = resetStage;

[COLOR=Black]I have a button on the main timeline that eases the position of the movieclip (containing the script) to a spot. When i test the movie, whenever I click on the button, the movieclip (hence the camera) does not move at all. Any advice is appreciated.[/COLOR]  
[/COLOR]
