EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Length (Point.length Property); Normalize (Point.normalize Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1014 ActionScript classes
var interpolatedPoint:Point = Point.interpolate(point_1, point_2, .5);
trace(interpolatedPoint.toString()); // (x=-25, y=-25)
length (Point.length property)
public length : Number
The length of the line segment from (0,0) to this point.
Availability: ActionScript 1.0; Flash Player 8
Example
The following example creates a Point object,
myPoint, and determines the length of a line
from (0, 0) to that Point.
import flash.geom.Point;
var myPoint:Point = new Point(3,4);
trace(myPoint.length); // 5
See also
polar (Point.polar method)
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)

Table of Contents

Related product manuals