00:00
00:00
Newgrounds Background Image Theme

Mekatov just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Issues with setMask

1,317 Views | 3 Replies
New Topic Respond to this Topic

Issues with setMask 2005-12-26 15:22:03


Hi there. I have been fooling around with, trying to create a, I'm not sure what you call them in english, the kind of lottery ticket you scratch the surface off. To do this I used the MovieClip.setMask method together with some API. However, this created some issues. When you scratch again at the already scratched areas, it covers them again. It's like it deletes the fills of my Movie clip when I try to add more. This does not happen if I don't mask. It is kinda hard to explain, so I'll show you two examples.

With masking
Without masking the scratched areas (for debugging purposes)

Does anyone know a way to get around this, or know if I did something wrong? And don't worry about the lag that appears after a while, concentrate on the problem. =)


BBS Signature

Response to Issues with setMask 2005-12-26 16:29:49


Depending on how you have everything stored, you may be able to make a boolean statement to determine whether or not it can be scractched off or not.

//when it loads, or in the _root
canScratch = true

//placement depends on your code.
if(canScratch){
//do scratch function
}

INSIDE the function that controls the scratch, after it is scratched.... set canScratch = false.

Response to Issues with setMask 2005-12-26 16:34:55


At 12/26/05 04:29 PM, Johnny_Krysys wrote: Depending on how you have everything stored, you may be able to make a boolean statement to determine whether or not it can be scractched off or not.

Nah, that way I would have to use a boolean for every pixel, and then somehow make the API not draw that pixel if it is scratched... Which reminds me of BitmapData, which surely is a better way to do this... I'll do that instead.

Still, I would like to find out what's wrong with this if anyone has any idea.


BBS Signature

Response to Issues with setMask 2005-12-26 16:38:26


Eeek! Every pixel! Nvm.