Adobe® AIR® API Reference for HTML Developers
Home  |  Show Classes List |  Index  |  Appendixes

Language Reference only       
Point 
3D:
Context3D
Context3DBlendFactor
Context3DClearMask
Context3DCompareMode
Context3DProgramType
Context3DRenderMode
Context3DStencilAction
Context3DTextureFormat
Context3DTriangleFace
Context3DVertexBufferFormat
CubeTexture
IndexBuffer3D
Program3D
Stage3D
Texture
VertexBuffer3D
Air.net:
ServiceMonitor
SocketMonitor
URLMonitor
Air.update:
ApplicationUpdater
ApplicationUpdaterUI
DownloadErrorEvent
StatusFileUpdateErrorEvent
StatusFileUpdateEvent
StatusUpdateErrorEvent
StatusUpdateEvent
UpdateEvent
Data:
EncryptedLocalStore
SQLCollationType
SQLColumnNameStyle
SQLColumnSchema
SQLConnection
SQLError
SQLErrorEvent
SQLErrorOperation
SQLEvent
SQLIndexSchema
SQLMode
SQLResult
SQLSchema
SQLSchemaResult
SQLStatement
SQLTableSchema
SQLTransactionLockType
SQLTriggerSchema
SQLUpdateEvent
SQLViewSchema
Desktop:
Clipboard
ClipboardFormats
ClipboardTransferMode
DockIcon
Icon
InteractiveIcon
NativeApplication
NativeProcess
NativeProcessStartupInfo
NotificationType
SystemTrayIcon
Display:
BitmapData
NativeMenu
NativeMenuItem
Screen
Stage
StageDisplayState
StageQuality
Events:
ActivityEvent
AsyncErrorEvent
BrowserInvokeEvent
DataEvent
DatagramSocketDataEvent
DNSResolverEvent
DRMAuthenticateEvent
DRMStatusEvent
ErrorEvent
Event
EventDispatcher
FileListEvent
HTTPStatusEvent
InvokeEvent
InvokeEventReason
IOErrorEvent
LocationChangeEvent
MouseEvent
NativeProcessExitEvent
NetDataEvent
NetMonitorEvent
NetStatusEvent
OutputProgressEvent
ProgressEvent
SampleDataEvent
SecurityErrorEvent
ServerSocketConnectEvent
StatusEvent
StorageVolumeChangeEvent
TimerEvent
UncaughtErrorEvent
UncaughtErrorEvents
File:
File
FileMode
FileStream
StorageVolume
StorageVolumeInfo
Functions:
trace()
generateRandomBytes()
navigateToURL()
sendToURL()
Geom:
Matrix
Point
Rectangle
Media:
AudioDecoder
AudioPlaybackMode
H264Level
H264Profile
H264VideoStreamSettings
ID3Info
InputMediaStream
Microphone
MicrophoneEnhancedMode
MicrophoneEnhancedOptions
Sound
SoundChannel
SoundCodec
SoundLoaderContext
SoundMixer
SoundTransform
VideoCodec
VideoStatus
VideoStreamSettings
Native window:
NativeWindow
NativeWindowBoundsEvent
NativeWindowDisplayState
NativeWindowDisplayStateEvent
NativeWindowInitOptions
NativeWindowRenderMode
NativeWindowResize
NativeWindowSystemChrome
NativeWindowType
Net:
AAAARecord
ARecord
CertificateStatus
DatagramSocket
DNSResolver
FileFilter
InterfaceAddress
IPVersion
LocalConnection
MXRecord
NetConnection
NetMonitor
NetStreamAppendBytesAction
NetStreamMulticastInfo
NetworkInfo
NetworkInterface
ObjectEncoding
PTRRecord
ResourceRecord
Responder
SecureSocket
ServerSocket
SharedObject
SharedObjectFlushStatus
Socket
SRVRecord
URLLoader
URLLoaderDataFormat
URLRequest
URLRequestDefaults
URLRequestHeader
URLRequestMethod
URLStream
URLVariables
XMLSocket
Security:
ReferencesValidationSetting
RevocationCheckSettings
SignatureStatus
SignerTrustSettings
X500DistinguishedName
X509Certificate
XMLSignatureValidator
System:
Capabilities
Security
System
Updater
Ui:
Keyboard
KeyboardType
KeyLocation
Mouse
MouseCursorData
Utils:
Vector
ByteArray
Collator
CollatorMode
CompressionAlgorithm
CurrencyFormatter
CurrencyParseResult
DateTimeFormatter
DateTimeNameContext
DateTimeNameStyle
DateTimeStyle
Endian
HTMLLoader
HTMLPDFCapability
LastOperationStatus
LocaleID
NationalDigitsType
NumberFormatter
NumberParseResult
StringTools
Timer
window.runtime propertywindow.runtime.flash.geom.Point
InheritancePoint Inheritance Object

Runtime Versions: AIR 1.0,

The Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.

The following code creates a point at (0,0):

var myPoint = new Point();

Methods and properties of the following classes use Point objects:

  • NativeWindow
  • Rectangle

You can use the new Point() constructor to create a Point object.

View the examples

See also



Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  length : Number
[read-only] The length of the line segment from (0,0) to this point.
Point
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  x : Number
The horizontal coordinate of the point.
Point
  y : Number
The vertical coordinate of the point.
Point
Public Methods
 MethodDefined By
  
Point(x:Number = 0, y:Number = 0)
Creates a new point.
Point
  
Adds the coordinates of another point to the coordinates of this point to create a new point.
Point
  
Creates a copy of this Point object.
Point
  
copyFrom(sourcePoint:Point):void
Copies all of the point data from the source Point object into the calling Point object.
Point
  
distance(pt1:Point, pt2:Point):Number
[static] Returns the distance between pt1 and pt2.
Point
  
equals(toCompare:Point):Boolean
Determines whether two points are equal.
Point
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
  
interpolate(pt1:Point, pt2:Point, f:Number):Point
[static] Determines a point between two specified points.
Point
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
normalize(thickness:Number):void
Scales the line segment between (0,0) and the current point to a set length.
Point
  
offset(dx:Number, dy:Number):void
Offsets the Point object by the specified amount.
Point
  
polar(len:Number, angle:Number):Point
[static] Converts a pair of polar coordinates to a Cartesian point coordinate.
Point
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
  
setTo(xa:Number, ya:Number):void
Sets the members of Point to the specified values
Point
  
Subtracts the coordinates of another point from the coordinates of this point to create a new point.
Point
 Inherited
toLocaleString():String
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
  
toString():String
Returns a string that contains the values of the x and y coordinates.
Point
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
Property Detail

length

property
length:Number  [read-only]

Runtime Versions: AIR 1.0,

The length of the line segment from (0,0) to this point.

See also

x

property 
public var x:Number

Runtime Versions: AIR 1.0,

The horizontal coordinate of the point. The default value is 0.

y

property 
public var y:Number

Runtime Versions: AIR 1.0,

The vertical coordinate of the point. The default value is 0.

Constructor Detail

Point

()Constructor
public function Point(x:Number = 0, y:Number = 0)

Runtime Versions: AIR 1.0,

Creates a new point. If you pass no parameters to this method, a point is created at (0,0).

Parameters
x:Number (default = 0) — The horizontal coordinate.
 
y:Number (default = 0) — The vertical coordinate.
Method Detail

add

()method
public function add(v:Point):Point

Runtime Versions: AIR 1.0,

Adds the coordinates of another point to the coordinates of this point to create a new point.

Parameters

v:Point — The point to be added.

Returns
Point — The new point.

clone

()method 
public function clone():Point

Runtime Versions: AIR 1.0,

Creates a copy of this Point object.

Returns
Point — The new Point object.

copyFrom

()method 
public function copyFrom(sourcePoint:Point):void

Runtime Versions:  3.0

Copies all of the point data from the source Point object into the calling Point object.

Parameters

sourcePoint:Point — The Point object from which to copy the data.

distance

()method 
public function distance(pt1:Point, pt2:Point):Number

Runtime Versions: AIR 1.0,

Returns the distance between pt1 and pt2.

Parameters

pt1:Point — The first point.
 
pt2:Point — The second point.

Returns
Number — The distance between the first and second points.

equals

()method 
public function equals(toCompare:Point):Boolean

Runtime Versions: AIR 1.0,

Determines whether two points are equal. Two points are equal if they have the same x and y values.

Parameters

toCompare:Point — The point to be compared.

Returns
Boolean — A value of true if the object is equal to this Point object; false if it is not equal.

interpolate

()method 
public function interpolate(pt1:Point, pt2:Point, f:Number):Point

Runtime Versions: AIR 1.0,

Determines a point between two specified points. The parameter f determines where the new interpolated point is located relative to the two end points specified by parameters pt1 and pt2. The closer the value of the parameter f is to 1.0, the closer the interpolated point is to the first point (parameter pt1). The closer the value of the parameter f is to 0, the closer the interpolated point is to the second point (parameter pt2).

Parameters

pt1:Point — The first point.
 
pt2:Point — The second point.
 
f:Number — The level of interpolation between the two points. Indicates where the new point will be, along the line between pt1 and pt2. If f=1, pt1 is returned; if f=0, pt2 is returned.

Returns
Point — The new, interpolated point.

normalize

()method 
public function normalize(thickness:Number):void

Runtime Versions: AIR 1.0,

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

Parameters

thickness: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).

See also

offset

()method 
public function offset(dx:Number, dy:Number):void

Runtime Versions: AIR 1.0,

Offsets the Point object by the specified amount. The value of dx is added to the original value of x to create the new x value. The value of dy is added to the original value of y to create the new y value.

Parameters

dx:Number — The amount by which to offset the horizontal coordinate, x.
 
dy:Number — The amount by which to offset the vertical coordinate, y.

polar

()method 
public function polar(len:Number, angle:Number):Point

Runtime Versions: AIR 1.0,

Converts a pair of polar coordinates to a Cartesian point coordinate.

Parameters

len:Number — The length coordinate of the polar pair.
 
angle:Number — The angle, in radians, of the polar pair.

Returns
Point — The Cartesian point.

See also

setTo

()method 
public function setTo(xa:Number, ya:Number):void

Runtime Versions:  3.0

Sets the members of Point to the specified values

Parameters

xa:Number — the values to set the point to.
 
ya:Number

subtract

()method 
public function subtract(v:Point):Point

Runtime Versions: AIR 1.0,

Subtracts the coordinates of another point from the coordinates of this point to create a new point.

Parameters

v:Point — The point to be subtracted.

Returns
Point — The new point.

toString

()method 
public function toString():String

Runtime Versions: AIR 1.0,

Returns a string that contains the values of the x and y coordinates. The string has the form "(x=x, y=y)", so calling the toString() method for a point at 23,17 would return "(x=23, y=17)".

Returns
String — The string representation of the coordinates.
Examples

The following example uses the PointExample class to create a number of new Point objects at various x,y coordinates and then uses the trace() method to output the results of various class methods.

Note: To test this example:

  1. Add the AIRAliases.js file to the project directory.
  2. Create an application descriptor file for the project, and test the project using ADL.
<html>
    <head>
      <script src="AIRAliases.js" />
      <script>
        function init() {
        var point1 = new air.Point();
        air.trace(point1);  // (x=0, y=0)
        
        var point2 = new air.Point(6, 8);
        air.trace(point2); // (x=6, y=8)
        
        air.trace(air.Point.interpolate(point1, point2, 0.5)); // (x=3, y=4)
        
        air.trace(air.Point.distance(point1, point2)); // 10
        
        air.trace(point1.add(point2)); // (x=6, y=8)
        
        var point3 = point2.clone();
        air.trace(point2.equals(point3)); // true
        
        point3.normalize(2.5);
        air.trace(point3); // (x=1.5, y=2)
        
        air.trace(point2.subtract(point3)); // (x=4.5, y=6)
        
        air.trace(point1.offset(2, 3)); // 
        
        var angle = Math.PI * 2 * (30 / 360); // 30°
        air.trace(air.Point.polar(4, angle)) // (x=3.464101615137755, y=1.9999999999999998)   
        }
      </script>
    </head>
    <body onload='init()'>
    </body>
</html>