1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// Création du clip conteneur
var clip:Sprite = new Sprite();
addChild(clip);
// Création de la forme maquée
var forme:Shape = new Shape();
forme.graphics.beginFill(0x666666);
forme.graphics.drawRect(0, 0, 300, 300);
forme.graphics.endFill();
clip.addChild(forme);
// Création et application du masque
var masque:Shape = new Shape();
masque.graphics.beginFill(0xFF0000);
masque.graphics.drawRect(0, 0, 100, 100);
masque.graphics.endFill();
clip.addChild(masque);
forme.mask = masque;
// Sortie
trace(clip.width); //=> 300
trace(clip.getRect(this)); //=> (x=0, y=0, w=300, h=300)
trace(clip.getBounds(this)); //=> (x=0, y=0, w=300, h=300) |
Partager