Flash CS4 PerspectiveProjection projectionCenter with action script

This code show how to use PerspectiveProjection, projectionCenter tranform, point

var img:Bitmap=new Bitmap(new heart(158, 58));
img.x=-158/2;
img.y=-58/2;
var holder:Sprite=new Sprite();
addChild(holder);
holder.x=stage.stageWidth/2;
holder.y=stage.stageHeight/2;
holder.addChild(img);

var pp:PerspectiveProjection=new PerspectiveProjection();
pp.fieldOfView = 120
pp.projectionCenter=new Point(holder.x,holder.y);
holder.transform.perspectiveProjection=pp;

function swingImage(e:Event):void {
	holder.rotationY+=3;
}
this.addEventListener(Event.ENTER_FRAME, swingImage);

This movie requires Flash Player 9

Tags: , , , , , , , ,

One Response to “Flash CS4 PerspectiveProjection projectionCenter with action script on “Flash CS4 PerspectiveProjection projectionCenter with action script”

Hi, Stranger! Leave Your Comment...

Name (required)
Email (required)
Website