Monday, March 22, 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