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.

}<br />

>> width: 4<br />

>> y: 2<br />

>> x: 1<br />

for(var i in clonedRect) {<br />

trace(">> " + i + ": " + clonedRect[i]);<br />

>> toString: [type Function]<br />

>> equals: [type Function]<br />

>> union: [type Function]<br />

>> intersects: [type Function]<br />

>> intersection: [type Function]<br />

>> containsRectangle: [type Function]<br />

>> containsPoint: [type Function]<br />

>> contains: [type Function]<br />

>> offsetPoint: [type Function]<br />

>> offset: [type Function]<br />

>> inflatePoint: [type Function]<br />

>> inflate: [type Function]<br />

>> size: (x=4, y=8)<br />

>> bottomRight: (x=5, y=10)<br />

>> topLeft: (x=1, y=2)<br />

>> bottom: 10<br />

>> top: 2<br />

>> right: 5<br />

>> left: 1<br />

>> isEmpty: [type Function]<br />

>> setEmpty: [type Function]<br />

>> clone: [type Function]<br />

>> height: 8<br />

>> width: 4<br />

>> y: 2<br />

>> x: 1<br />

}<br />

Pour mieux illustrer les relations existant entre rect_1, rect_2 et clonedRect, l'exemple ci<strong>de</strong>ssous<br />

modifie la propriété x <strong>du</strong> rect_1. La modification <strong>de</strong> x montre que la métho<strong>de</strong><br />

clone() crée une nouvelle occurrence, basée sur les valeurs <strong>du</strong> rect_1, au lieu <strong>de</strong> leur faire<br />

référence.<br />

import flash.geom.Rectangle;<br />

var rect_1:Rectangle = new Rectangle(1, 2, 4, 8);<br />

var rect_2:Rectangle = rect_1;<br />

var clonedRect:Rectangle = rect_1.clone();<br />

trace(rect_1.x); // 1<br />

trace(rect_2.x); // 1<br />

trace(clonedRect.x); // 1<br />

1072 Chapitre 2: Classes <strong>ActionScript</strong>

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

Saved successfully!

Ooh no, something went wrong!