MotionCamera (com.robertpenner.effects.MotionCamera)

mx.transitions.Tween
        |
        +--com.robertpenner.effects.MotionCamera
class MotionCamera
extends Tween

A MotionCamera instance can record the movement of a single "actor" property onto its own "film". It can then play it back, to the same property (the actor) or to a different property.

Availability:

ActionScript 2.0; Flash Player 6

Property summary

Property Description
actor:Object

The actor to be targetted by the MotionCamera.

actorProp:String

The actor's property to be targetted by the MotionCamera.

film:Array

The film of the MotionCamera.

filmString:String

The film of the MotionCamera as a comma-delimited list.

mode:String

The current mode of the MotionCamera.

duration:Number

The duration of the tweened animation in frames or seconds.

finish:Number

The last tweened value for the end of the tweened animation.

FPS:Number

The number of frames per second of the tweened animation.

position:Number

The current value of the target movie clip's property being tweened.

time:Number

The current time within the duration of the animation.

Event summary

Event Description
onMotionChanged = function() {}

Event broadcast with each change in the tweened object's property that is being animated.

onMotionFinished = function() {}

Event broadcast when the Tween object finishes its animation.

onMotionLooped = function() {}

Event broadcast when the Tween object loops.

onMotionResumed = function() {}

Event broadcast when the Tween.resume() method is called, causing the tweened animation to resume.

onMotionStarted = function() {}

Event broadcast when the Tween.start() method is called, causing the tweened animation to start.

onMotionStopped = function() {}

Event broadcast when the Tween.stop() method is called, causing the tweened animation to stop.

Method summary

Method Description
startRecord() : Void

Turns the MotionCamera's recording mode on.

stopRecord() : Void

Turns the MotionCamera's recording mode off.

cutFilm(t:Number) : Void

Cuts the film to a specific length.

eraseFilm() : Void

Blanks out the film. Effectively clears the data.

getPosition(t:Number) : Number

Returns the position at a specified time.

setActor(actor:Object, actorProp:String) : Void

Sets the actor and actor's property to be targetted by the MotionCamera.

continueTo(finish:Number, duration:Number) : Void

Instructs the tweened animation to continue from its current value to a new value.

fforward() : Void

Forwards the tweened animation directly to the end of the animation.

nextFrame() : Void

Forwards the tweened animation to the next frame.

prevFrame() : Void

Directs the tweened animation to the frame previous to the current frame.

resume() : Void

Resumes a tweened animation from its stopped point in the animation.

rewind() : Void

Rewinds a tweened animation to the beginning of the tweened animation.

start() : Void

Starts the tweened animation from the beginning.

stop() : Void

Stops the tweened animation at its current position.

toString() : String

Returns a summarization of the MotionCamera instance.

print() : Void

Traces a comma-delimited list of the film to the Output window.

yoyo() : Void

Instructs the tweened animation to play in reverse from its last direction of tweened property increments.

MotionCamera(obj:Object, prop:String, duration:Number)

Usage


var xCam:MotionCamera = new MotionCamera(this, "_x", 0);

Parameters

obj:Object - The object which the MotionCamera targets.

prop:String - The name of the property (in obj) that will be affected.

duration:Number - The length of time of the motion; set to infinity if negative, 0 or omitted.

Description

Creates an instance of the MotionCamera class.


startRecord() : Void

Usage


xCam.startRecord();

Parameters

Returns

Nothing.

Description

Turns the MotionCamera's recording mode on.


stopRecord() : Void

Usage


xCam.stopRecord();

Parameters

Returns

Nothing.

Description

Turns the MotionCamera's recording mode off.


cutFilm(t:Number) : Void

Usage


xCam.cutFilm();

Parameters

t:Number - A specific point in time to cut the film; uses the current time if left blank.

Returns

Nothing.

Description

Cuts the film to a specific length.


eraseFilm() : Void

Usage


xCam.eraseFilm();

Parameters

Returns

Nothing.

Description

Blanks out the film. Effectively clears the data.


getPosition(t:Number) : Number

Usage


trace (xCam.getPosition());

Parameters

t:Number - The time to check the object's position; set to the current time if omitted.

Returns

The position.

Description

Returns the position at a specified time.


setActor(actor:Object, actorProp:String) : Void

Usage


trace (xCam.setActor(this, "_y"));

Parameters

actor:Object - The actor to be targetted by the MotionCamera.

actorProp:String - The actor's property to be targetted by the MotionCamera.

Returns

Nothing.

Description

Sets the actor and actor's property to be targetted by the MotionCamera.


continueTo(finish:Number, duration:Number) : Void

Usage


myTween.continueTo(myFinish, myDuration);

Parameters

finish:Number - A number indicating the ending value of the target object property that is to be tweened.

duration:Number - A number indicating the length of time or number of frames for the tween motion.

Returns

Nothing.

Description

Instructs the tweened animation to continue from its current value to a new value.


fforward() : Void

Usage


myTween.fforward();

Parameters

Returns

Nothing.

Description

Forwards the tweened animation directly to the end of the animation.


nextFrame() : Void

Usage


myTween.nextFrame();

Parameters

Returns

Nothing.

Description

Forwards the tweened animation to the next frame.


prevFrame() : Void

Usage


myTween.prevFrame();

Parameters

Returns

Nothing.

Description

Directs the tweened animation to the frame previous to the current frame.


resume() : Void

Usage


myTween.resume();

Parameters

Returns

Nothing.

Description

Resumes a tweened animation from its stopped point in the animation.


rewind() : Void

Usage


myTween.rewind();

Parameters

Returns

Nothing.

Description

Rewinds a tweened animation to the beginning of the tweened animation.


start() : Void

Usage


myTween.start();

Parameters

Returns

Nothing.

Description

Starts the tweened animation from the beginning.


stop() : Void

Usage


myTween.stop();

Parameters

Returns

Nothing.

Description

Stops the tweened animation at its current position.


toString() : String

Usage


trace (xCam.toString());
trace (xCam);

Parameters

Returns

Returns a summarization of the MotionCamera instance.

Description

Returns a summarization of the MotionCamera instance.


print() : Void

Usage


xCam.print();

Parameters

Returns

Nothing.

Description

Traces a comma-delimited list of the film to the Output window.


yoyo() : Void

Usage


myTween.yoyo();

Parameters

Returns

Nothing.

Description

Instructs the tweened animation to play in reverse from its last direction of tweened property increments.


onMotionChanged = function() {}

Usage


myTween.onMotionChanged = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast with each change in the tweened object's property that is being animated.


onMotionFinished = function() {}

Usage


myTween.onMotionFinished = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween object finishes its animation.


onMotionLooped = function() {}

Usage


myTween.onMotionLooped = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween object loops.


onMotionResumed = function() {}

Usage


myTween.onMotionResumed = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween.resume() method is called, causing the tweened animation to resume.


onMotionStarted = function() {}

Usage


myTween.onMotionStarted = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween.start() method is called, causing the tweened animation to start.


onMotionStopped = function() {}

Usage


myTween.onMotionStopped = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween.stop() method is called, causing the tweened animation to stop.


actor : Object

Usage


xCam.actor = this;

Description

The actor to be targetted by the MotionCamera.


actorProp : String

Usage


xCam.actorProp = "_y";

Description

The actor's property to be targetted by the MotionCamera.


film : Array

Usage


xCam.film = [24, 53, 62, 59, 86, 23, 123];

Description

The film of the MotionCamera.


filmString : String

Usage


xCam.filmString = "24, 53, 62, 59, 86, 23, 123";

Description

The film of the MotionCamera as a comma-delimited list.


mode : String

Usage


trace (xCam.mode);

Description

The current mode of the MotionCamera.


duration : Number

Usage


trace (myTween.duration);

Description

The duration of the tweened animation in frames or seconds.


finish : Number

Usage


trace (myTween.finish);

Description

The last tweened value for the end of the tweened animation.


FPS : Number

Usage


trace (myTween.FPS);

Description

The number of frames per second of the tweened animation.


position : Number

Usage


trace (myTween.position);

Description

The current value of the target movie clip's property being tweened.


time : Number

Usage


trace (myTween.time);

Description

The current time within the duration of the animation.