This content has been marked as final. Show 8 replies
the method you used to mask is correct but the place you used is incorrect.
we can't expect that the image will be loaded immediately. while loading it will remove all the property of the movieClip
so either use MovieClip Loader Class or use another movie inside the blank_mc (call it as image_mc)
and load image in side that
//3. Setting Mask
_root.attachMovie('MaskMC', 'mask_mc', 10);
There's nothing wrong with the code itself, it's when you're applying it.
loadMovie is asynchronous, you have to wait for it to complete before doing
the setMask. So, your better option is to use the MovieClipLoader class, and
then setMask in the onLoadInit method - once the clip is actually loaded.
Adobe Community Expert
Thanks for the reply. But I already did with MovieClipLoader also and that works fine. But My main question is this: if i set a Mask already then after that if i load any external Image then why it cause the problem to set Mask? have you any idea of this or this is just a bug of Flash?
If you Load any Image or SWF inside a Movie Clip, That MovieClip will lost all the Data you stored.
and it will have the loaded Clips Data.
Hi Thanks for both of you.
OK fine.. Now Devendran, as you said that this Movieclip will lost all the data, when image will be loaded, but if you will see my code i am attaching mask movie in the root, not in that blank_mc, which is loading image. So what can you say about this.
I just want to clear my idea about masking at runtime. So please don't hesitate to reply me. Thanks in advance.
You are attaching mask to the Stage
But you are using the mask to the MovieClip which is loading the Image.
When you use "setMask" the MovieClip reference will be stored, in the Same way the ContentData will be Stored to the Mask MC.
So either loading file inside Mask_mc or in Content_mc after the mask, will remove the mask.
Below code is a simple implementation if you planned to mask a Movie which is loading external file
Oh great thanks Devendran. i think its sufficient for me. I think you are right about the same time loading and masking concept. Thanks a lot :)