First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Taro | Website: http://www.nuke-bros.cjb.net
Wanna know something cool? You can create an dynamic camera to follow certain events! Draw a semi-transparent rectangle, put a cross in the middle, convert it to a movie clip (F8). Be sure i instance name it camFrame. Then inside the movie clip, make a new layer. Label this layer "actions" and paste this code into the blank keyframe:

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;

Not sure why it works, it just does. remember, your actionscript must be set to 2.0, and be sure you get all the code. Need at least flash player 6. Now you can create AMAZING zooms, pans or whatever, but the camera's width and height must be proportionate to your stage width and height.

» Level Basic

Added: 2006-02-09
Rating: 4 Votes: 7
(10 being the highest)
» Author
I came across this on NewGrounds.com, now you too can create wicked-awesome stuff!
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.