First time here? First time here? Newsletter Signup Newsletter
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: 3.33 Votes: 9
» 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!
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
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: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.