Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-02-2007, 04:52 PM   #1
Registered User
Join Date: Oct 2007
Posts: 12
Default Masking a MovieClip with a MovieClip


I know this sounds simple, using the MovieClip.setMask(maskClip) syntax - but I just can't get it to work!

I have one movieclip (which loads an image, this is the Maskee) and a second movieclip which loads an instance of an object (a filled shape). I then want to mask the image.

On Combobox Change

on(change) {
	if(this.selectedItem.data != "-1") {
		_root.design.mcForeground._xscale = 50;
		_root.design.mcForeground._yscale = 40;

No syntax errors are found - the only symptom is that the shape (in this case a lovely bunny) doesn't mask the background (a picture of a carpet).

I was playing around with the .setMask method earlier and it worked perfectly. I'm not sure what I'm missing, and would really love any advice! Apologies if I'm being rather stupid!

The Results:
Click image for larger version

Name:	bunny..jpg
Views:	44
Size:	73.1 KB
ID:	24232

dave_reach is offline   Reply With Quote
Old 10-02-2007, 05:06 PM   #2
Super Moderator
xxneon's Avatar
Join Date: Dec 2006
Location: Amish Country, PA
Posts: 8,570
Send a message via ICQ to xxneon Send a message via AIM to xxneon Send a message via MSN to xxneon Send a message via Skype™ to xxneon

since your using loadMovie to load the image of the carpet in .. you can't set the mask till after the image is initialized.. if you set the mask right after the loadMovie call.. it gets .. 'erased' .. is the best way to put it i guess..

so you need to have a way of listening to see when the image is loaded and initialized.. check out using the MovieClipLoader class .. it has event handlers to handle when an image is loaded in completely .. and then you could set your mask after the image is completely downloaded..

the other alternative is creating a small function to watch the download progress of the image that is being loaded in with loadMovie.. and then when a condition is met .. (loaded bytes == total bytes) for example .. then set the mask ..
Always optimizing...
xxneon is offline   Reply With Quote
Old 10-02-2007, 06:27 PM   #3
Registered User
Join Date: Oct 2007
Posts: 12

Ahhh, perfect mate. I'll get on that tomorrow.

dave_reach is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Buttons in movieclip don't work FlashAlison ActionScript 2.0 11 03-07-2007 11:46 PM
The second time a movieclip is attaced it shal just play from the beginning fiona ActionScript 2.0 0 04-17-2006 04:46 PM
masking movieclip? ebbhead2 ActionScript 1.0 (and below) 0 03-30-2005 07:20 PM
Button on a MovieClip? Talon ActionScript 2.0 2 04-26-2004 03:51 PM
AttachMovie enlarges movieClip size Torontonian ActionScript 1.0 (and below) 5 08-15-2003 12:10 PM

All times are GMT. The time now is 06:58 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.