mercredi 17 octobre 2012

NCL2dLocation

- var location = new NCL2dLocation(x,y)


create a new NCL2dLocation object. 

-x : the x-coordinate of the location.

-y : the y-coordinate of the location.


Example: 

this.location = new NCL2dLocation(20,30);
alert("x="+this.location.x+"y="+this.location.y);

Object functions



NCL2dLocation.getLocation()

return an array with x and y coordinates.

example:
var coord = location.getLocation();
var x = coord[0];
var y = coord[1];



NCL2dLocation.setX(number)

set the x coordinate of the location

example: 
var location = new NCL2dLocation(10,10);
location.setX(30);


NCL2dLocation.setY(number)

set the y coordinate of the location

example: 
var location = new NCL2dLocation(10,10);
location.setY(30);


NCL2dLocation.toString()

return a string who represents the object. "[x:y]";

example: 
var location = new NCL2dLocation(10,10);
alert(location.toString());

Aucun commentaire:

Enregistrer un commentaire