03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

var point_1:Point = new Point(4, 8);<br />

var point_2:Point = new Point(1, 2);<br />

var resultPoint:Point = point_1.subtract(point_2);<br />

trace(resultPoint.toString()); // (x=3, y=6)<br />

toString (métho<strong>de</strong> Point.toString)<br />

public toString() : String<br />

Renvoie une chaîne qui contient les valeurs <strong>de</strong>s coordonnées x et y. Elle prend la forme (x, y),<br />

un point avec les coordonnées 23,17 renvoie ainsi "(x=23, y=17)".<br />

Disponibilité : <strong>ActionScript</strong> 1.0 ; Flash Player 8<br />

Valeur renvoyée<br />

String - Une chaîne.<br />

Exemple<br />

L'exemple suivant crée un point et convertit ses valeurs en chaîne au format (x=x, y=y).<br />

import flash.geom.Point;<br />

var myPoint:Point = new Point(1, 2);<br />

trace("myPoint: " + myPoint.toString()); // (x=1, y=2)<br />

x (Point.x, propriété)<br />

public x : Number<br />

Les coordonnées horizontales <strong>du</strong> point. La valeur par défaut est 0.<br />

Disponibilité : <strong>ActionScript</strong> 1.0 ; Flash Player 8<br />

Exemple<br />

L'exemple suivant crée un objet Point myPoint et définit la valeur coordonnée x.<br />

import flash.geom.Point;<br />

var myPoint:Point = new Point();<br />

trace(myPoint.x); // 0<br />

myPoint.x = 5;<br />

trace(myPoint.x); // 5<br />

y (Point.y, propriété)<br />

public y : Number<br />

Coordonnée verticale <strong>du</strong> point. La valeur par défaut est 0.<br />

Disponibilité : <strong>ActionScript</strong> 1.0 ; Flash Player 8<br />

Point (flash.geom.Point) 1053

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!