Pow (Math.pow Method) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
}

pow (Math.pow method)

public static pow(x:Number, y:Number) : Number
Computes and returns
Availability: ActionScript 1.0; Flash Lite 2.0 - In Flash Player 4, the methods and properties
of the Math class are emulated using approximations and might not be as accurate as the non-
emulated math functions that Flash Player 5 supports.
Parameters
- A number to be raised to a power.
x:Number
- A number specifying a power the parameter
y:Number
Returns
- A number.
Number
Example
The following example uses
this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
this.origX = _xmouse;
this.origY = _ymouse;
};
mouseListener.onMouseUp = function() {
this.newX = _xmouse;
this.newY = _ymouse;
var minY = Math.min(this.origY, this.newY);
var nextDepth:Number = canvas_mc.getNextHighestDepth();
var line_mc:MovieClip =
canvas_mc.createEmptyMovieClip("line"+nextDepth+"_mc", nextDepth);
line_mc.moveTo(this.origX, this.origY);
line_mc.lineStyle(2, 0x000000, 100);
line_mc.lineTo(this.newX, this.newY);
var hypLen:Number = Math.sqrt(Math.pow(line_mc._width,
2)+Math.pow(line_mc._height, 2));
line_mc.createTextField("length"+nextDepth+"_txt",
canvas_mc.getNextHighestDepth(), this.origX, this.origY-22, 100, 22);
line_mc['length'+nextDepth+'_txt'].text = Math.round(hypLen) +" pixels";
};
Mouse.addListener(mouseListener);
424
ActionScript classes
to the power of
.
x
y
and
Math.pow
Math.sqrt
is raised to.
x
to calculate the length of a line.

Advertisement

Table of Contents
loading

Table of Contents