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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

trace(rect.toString()); // (x=1, y=2, w=4, h=8)<br />

rect.inflate(16, 32);<br />

trace(rect.toString()); // (x=-15, y=-30, w=36, h=72)<br />

Voir également<br />

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

inflatePoint (métho<strong>de</strong> Rectangle.inflatePoint)<br />

public inflatePoint(pt:Point) : Void<br />

Agrandit la taille <strong>de</strong> l'objet Rectangle. Cette métho<strong>de</strong> est similaire à la métho<strong>de</strong><br />

Rectangle.inflate(), à ceci près qu'elle prend un objet Point comme paramètre.<br />

On obtient le même résultat avec les <strong>de</strong>ux exemples <strong>de</strong> co<strong>de</strong> suivants :<br />

rect1 = new flash.geom.Rectangle(0,0,2,5);<br />

rect1.inflate(2,2)<br />

rect1 = new flash.geom.Rectangle(0,0,2,5);<br />

pt1 = new flash.geom.Point(2,2);<br />

rect1.inflatePoint(pt1)<br />

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

Paramètres<br />

pt:flash.geom.Point - Agrandit le rectangle en fonction <strong>de</strong>s coordonnées x et y <strong>du</strong> point.<br />

Exemple<br />

L'exemple suivant crée un objet Rectangle et l'agrandit en fonction <strong>de</strong>s montants x<br />

(horizontal) et y (vertical) figurant dans un point.<br />

import flash.geom.Rectangle;<br />

import flash.geom.Point;<br />

var rect:Rectangle = new Rectangle(0, 0, 2, 5);<br />

trace(rect.toString()); // (x=0, y=0, w=2, h=5<br />

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

rect.inflatePoint(myPoint);<br />

trace(rect.toString()); // (x=-2, y=-2, w=6, h=9)<br />

Voir également<br />

Point (flash.geom.Point)<br />

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

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

Saved successfully!

Ooh no, something went wrong!