all groups > flash (macromedia) > march 2005 >
You're in the

flash (macromedia)

group:

Masking loaded movies/jpg's


Masking loaded movies/jpg's RSegars
3/25/2005 9:17:53 PM
flash (macromedia):
I'm using the action script below to load a series of images into my Flash
file. I'd like to have a mask above this file that obscures parts of the
images. How would I go about masking these loaded images?

createEmptyMovieClip("pic_holder", 0);
pic_holder._x = 7;
pic_holder._y = 7;
pic_holder.loadMovie("house1.jpg");
Re: Masking loaded movies/jpg's anilnatha
3/25/2005 9:31:07 PM
very simple.

you can use the MovieClip.setMask(mc) function to apply a mask to a
dynamically created & loaded movieclip.

basically mc can be a movieclip that was created at compile time and during
runtime of your flash movie it can be applied to the dynamically created
movieclip whenever you want.

you could even take it a step further and dynamically create a movie clip for
the mask and use the Movie Clip Drawing methods to draw the portions of the pic
you currently have loaded and then set the mask using the MovieClip.setMask(mc)
method.

It all depends on how intricate you want this to be
Re: Masking loaded movies/jpg's bruce_code
3/26/2005 3:22:05 PM
[quoted text, click to view]

Hi,

Using your suggestion here to RSegars, and Urami_'s suggestion to me on a
similar subject the other day, I have come up with this..., but it doesn't
work:

createEmptyMovieClip("wasabi_images", 0);
wasabi_images._x = 0;
wasabi_images._y = 0;
wasabi_images.loadMovie("wasabi_blader_01.jpg");
wasabi_images.setMask(wasabi_image_msk);

Where should this script go? I have it in the masking layer (layer 6) on
frame one (my swf only has one frame). It loads the JPG okay, but it is not
masked.


What am I doing wrong?


Thanks,

Bruce

Re: Masking loaded movies/jpg's anilnatha
3/26/2005 6:10:20 PM
Originally posted by: Newsgroup User
[quoted text, click to view]

Hi,

Using your suggestion here to RSegars, and Urami_'s suggestion to me on a
similar subject the other day, I have come up with this..., but it doesn't
work:

createEmptyMovieClip("wasabi_images", 0);
wasabi_images._x = 0;
wasabi_images._y = 0;
wasabi_images.loadMovie("wasabi_blader_01.jpg");
wasabi_images.setMask(wasabi_image_msk);

Where should this script go? I have it in the masking layer (layer 6) on
frame one (my swf only has one frame). It loads the JPG okay, but it is not
masked.


What am I doing wrong?


Thanks,

Bruce




If i'm not mistaken, the movieclip you are loading the clip into must be done
loading before you set the mask on it.

Try adding code to your fla to ensure that AFTER your clip has completed
loading the external file then it executes the setMask() call.
AddThis Social Bookmark Button