Dynamic masking using the drawing API
I can’t get this code to work. Is this complete?
http://www.actionscript.org/resource…API/Page3.html
Code:
onClipEvent(load)
{
_root.stop();
dO = 3.6;
r = 75;
function addSlice(O)
{
x1 = r*Math.sin(O*Math.PI/180);
x2 = r*Math.sin((O+dO)*Math.PI/180);
y1 = r*Math.cos((O)*Math.PI/180);
y2 = r*Math.cos((O+dO)*Math.PI/180);
trace(x1 + ":" + y1);
with(_root.mask)
{
moveTo(0,0);
beginFill(0x000088);
lineTo(x1,y1);
lineTo(x2,y2);
endFill();
}
}
_root.createEmptyMovieClip("mask",0);
this.setMask(_root.mask);
_root.mask._yscale = -100;
_root.mask._x = this._x;
_root.mask._y = this._y;
oldLoaded = 0;
}
onClipEvent(enterFrame)
{
loaded = Math.ceil(_root.getBytesLoaded()/_root.getBytesTotal()*100);
for(i = oldLoaded; i < loaded; i++)
{
addSlice(dO*i);
}
oldLoaded = loaded;
}1. I’ve created a donut mc.
2. Set the actionscript to the mc
3. put a photo on the next keyframe
Nothing Happens.
Any help?
Original post by rrrfusco