Penner AS2 ProFMX: MotionCamera Example

Motion Camera

Click image to view demo


Click around above and then let go, whatever motion you created will be repeated until you start clicking again. This is an example using the MotionCamera class from the Chapter 13 Penner AS2 post

To replicate this example, add an oval shaped MovieClip to the stage with an instance name of “oval”.
Then on the root timeline add the following code:

import com.robertpenner.effects.MotionCamera;

var xmouse_cam:MotionCamera = new MotionCamera (oval, "_xscale");
var ymouse_cam:MotionCamera = new MotionCamera (oval, "_y");

xmouse_cam.setActor (this, "_xmouse");
xmouse_cam.looping = true;
ymouse_cam.setActor (this, "_ymouse");
ymouse_cam.looping = true;

this.onMouseDown = function () {
	with (xmouse_cam) {
		eraseFilm();
		rewind();
		start();
		startRecord();
	}
	with (ymouse_cam) {
		eraseFilm();
		rewind();
		start();
		startRecord();
	}
};

this.onMouseUp = function () {
	with (xmouse_cam) {
		stopRecord();
		cutFilm();
		rewind();
	}
	with (ymouse_cam) {
		stopRecord();
		cutFilm();
		rewind();
	}
};

stop();
This entry was posted in Flash. Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

  • Pages

  • Categories

  • Archives