CodeLabMaster -> RE: Flash help and tutorials, come here to share your wisdom or ask questions (10/9/2005 18:56:32)
|
Oh, your talking about a 3D shifting type thing. That would be harder, but you could still probably do it with about 16 frames and some simple shape tweens and action script snipets, not 360 frames. NOTE: This is not my code, the code for this camera I found on the internet on I believe O'Rielly something. Nevertheless, it is some kickass code, so here. function camControl() {
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() {
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; To use it, just make a movie clip square and add this code snippet to it. EDIT: For sound, you would be suprised how easy it is. Just draw 6 mouths and put them all on differant keyframes in a movieclip called mouth. Next, change the symbol in a graphic, and set it to be a single frame. (Note: The six most common mouths are: Open Mouth, Lips Pressed, Teeth Clenched, O Mouth, Tounge on Teeth and smile closed mouth) Then, make that graphic symbol into another movie clip. Make the mouth graphic on layer 1, and the sound on layer 2, set the sound to stream so you can edit it easy. Then, just change the mouth over the course of alot of keyframes to whatever mouth goes with that sound. I'll make an example for you in a sec. EDIT2: CLICK THIS! You will have to wait a moment for it to load.
|
|
|
|