Simulated 3D Scaling With ActionScript

3 March, 2008 | ActionScript

The current version of Flash (8 at the time of writing) isn’t capable of real 3D graphics, so to create a simple fly by effect you need to use the _xscale and _yscale properties of a movie clip.

To do this create a movie clip and attach the following ActionScript code to the movie clip on the stage.

onClipEvent(load){
 x = 525;
 y = 25;
}
 
onClipEvent(enterFrame){
 this._xscale++;
 this._yscale++;
 this._x -= 5;
 this._y += 5;
}

When you run the movie you will see your shape move towards the bottom left hand corner and also appear to get bigger. This effect is best used on non-abstract shapes as it can just look like your cube gets bigger. Adding a vector image to your movie clip will give the best results.

Write a comment