normalize (Point.normalize method)

public normalize(length:Number) : Void

Scales the line segment between (0,0) and the current point to a set length.

Availability: ActionScript 1.0; Flash Player 8

Parameters

length:Number - The scaling value. For example, if the current point is (0,5), and you normalize it to 1, the point returned is at (0,1).

Example

The following example extends the length of the normalizedPoint object from 5 to 10.

import flash.geom.Point;
var normalizedPoint:Point = new Point(3, 4);
trace(normalizedPoint.length); // 5
trace(normalizedPoint.toString()); // (x=3, y=4)
normalizedPoint.normalize(10);
trace(normalizedPoint.length); // 10
trace(normalizedPoint.toString()); // (x=6, y=8)

See also

length (Point.length property)


Version 8

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002600.html