Friday, March 26, 2010

Need to apply a mask to loaded swf

this is what I need to fix:?http://mespinach.com/needmask/

this is my code I've been looking all over for an example of setting a mask using AS2

I have a container MovieClip I create dynamically I've tried to attach a movieclip to the container then set mask before loading the swf

I would like to know how to dynamically generate a mask or use a symbol from the library or stage if need be whatever works.

This is my code.

var container:MovieClip = createEmptyMovieClip(''container'', 3);
var mcLoader:MovieClipLoader = new MovieClipLoader();

mcLoader.addListener(this);
mcLoader.loadClip(''slideshow.swf'', container);


function onLoadInit(mc:MovieClip) {
?container._width = 600;
?container._height = 400;
?container._x = 200;
?container._y = 100;
}

Need to apply a mask to loaded swf

function onLoadInit(mc:MovieClip) {
?container._width = 600;
?container._height = 400;
?container._x = 200;
?container._y = 100;

var r:MovieClip = createEmptyMovieClip(''rectangles'', 2);
?r.beginFill(0xcc00cc, 100);
?r.moveTo(20, 20);
?r.lineTo(160, 20);
?r.lineTo(160, 160);
?r.lineTo(20, 160);
?container.setMask(r);
}

change the values as your need.

Need to apply a mask to loaded swf

When I tried that after the swf load as in your example nothing happened.?When I tried after container was created and before the swf was loaded I got a purple rectangle to the right of the swf.

That did it I just have the move the coordinates to within container.......THANKS!!!

You are welcome

No comments:

Post a Comment