hey guys, so i am having trouble getting a png(in bitmapdata form) from my library to mask a sprite that is loaded into the movie via loader.
so my setup is:
mainThumb : Sprite //empty sprite to contain bitmap loaded via loader
thumbMask : Sprite //sprite from the library that contains a png to be used as a mask for mainThumb
overlay : Bitmap //some effects to overlay image
thumb : Bitmap //bitmap loaded using loader to be added to mainThumb
from library:
Thumb_Mask : Sprite //the sprite in the library containing the png
Thumb_Overlay : BitmapData
and the code (that isn’t working)
function init(e:Event) : void { //called from contentloaderinfo's Event.COMPLETE
var thumb:Bitmap = e.target.content;
thumb.smoothing = true;
mainThumb = new Sprite();
mainThumb.addChild(thumb);
var overlay:Bitmap = new Bitmap(new Thumb_Overlay(0,0));
var thumbMask:Sprite = new Thumb_Mask();
mainThumb.x = overlay.x = thumbMask.x = -mainThumb.width/2;
mainThumb.mask = thumbMask;
this.addChild(mainThumb);
this.addChild(overlay);
...
i feel like this should work… but it doesn’t, nothing shows up at all using this code, but when i try commenting out the masking line, and adding addChild(thumbMask),the mask shows up in the correct position
any ideas why this isn’t working?
thanks a ton
edit: when i add the line, mainThumb.cacheAsBitmap = true, i see mainThumb but it is not masked…