Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-06-2012, 05:10 PM   #1
Registered User
Join Date: Mar 2010
Posts: 4
Default Simple mask won't "mask"

Hi everyone. I'm trying to learn more Actionscript and I have a very simple program that is not working. My ultimate goal is to manipulate a mask so I can impart movement to it so it reveals in a eyecatching way.
But, for starters, I can't get my very simple program to run.

I have three elements in the library; a background picture, a picture to be masked, and a square graphic about 50px by 50px which is to serve as the mask; all are typed MovieClips and have a linkage class matching their symbol names.

Here is my Actionscript code:

/*instantiate the movieclip classes */
var bk1:MovieClip = new backgrd();
var pic1:MovieClip = new picture();
var mask1:MovieClip = new squaremask();

/*specify positioning */
bk1.x = 275;
bk1.y = 200;
pic1.x = 275;
pic1.y = 200;
mask1.x = 275;
mask1.y = 200;

/*add them to the display list */

/*set the mask property
pic1.mask = mask1;

When I test my fla file, all I see is the background picture; there should be a square in the middle that reveals the target picture "pic1".

Would appreciate any comments,

captsig is offline   Reply With Quote
Old 07-06-2012, 11:00 PM   #2
Join Date: Jul 2011
Location: Layton City, Utah
Posts: 193

Try this. I just did a quick google search. I believe this is what you are trying to attempt.

ActionScript Code:
// Create mask var maskObject:Sprite = new Sprite(); maskObject.graphics.beginFill(0xFF0000); maskObject.graphics.drawRoundRect(myMC.x, myMC.y, 453, 290, 20); // Apply mask myMC.mask = maskObject;
USAFDrew2011 is offline   Reply With Quote
Old 07-06-2012, 11:13 PM   #3
Senior Member
[afz]snickelfitz's Avatar
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,400

background is on top of the masked picture. (obscuring it)
add the background to the displaylist before you add the picture and mask.
[afz]snickelfitz 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 On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:29 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.