PDA

View Full Version : masking...pretty much nothing


sporArbejder
03-22-2006, 03:31 PM
i am trying to get into actionscript 3.0, and am encountering troubles using the masking fascilities.
it should be as simple as oneShape.mask(theOtherShape); but teh flex compiler keeps insisting that 'Call to a possibly undefined method 'mask' through a reference with static type 'flash.display:Shape'.
here's what I tried out:

package {
import flash.display.MovieClip;
import flash.display.Graphics.*
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.*;
import flash.display.DisplayObject;
import flash.util.trace;
import flash.events.*;
//yeah the import is overkill but i wanted to figure out whether it was
//because i hadn't implemented a certain class I got that error message

public class slider extends MovieClip {
private var stageCon:Sprite=new Sprite();
public function slider() {
this.addChild(stageCon);
var maskee:Shape=new Shape();
var masked:Shape=new Shape();
maskee.graphics.beginFill(0x445544,1.0);
maskee.graphics.drawRect(10,100,100,50);
masked.graphics.beginFill(0x556677,1.0);
masked.graphics.drawRect(0,110,100,50);
stageCon.addChildAt(maskee,0);
stageCon.addChildAt(masked,1);
masked.mask(maskee);

}

}
}

hope somebody out there in the big sea of knowledge can see through this.

Y!

hangalot
03-22-2006, 06:52 PM
mask is a property not a method (you are thinking setMask from as2)

masked.mask = maskee;

sporArbejder
03-23-2006, 08:08 AM
didn't think these forum-thingies actually worked.
than you very much, hangalot - that helpedmealot.
sincerely

Y!

mask is a property not a method (you are thinking setMask from as2)

masked.mask = maskee;