From: adam on
Kindaian, I checked out the link and can?t get that code to return any results.
I think that I successfully create a new image, but I don?t know how to place
that image on the stage. In a separate post*
(http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=187&threadid
=1396437) asking about scripted sprite creation with a duplicated image I
outlined my broader goal. Below is a synopsis of what I?m trying to accomplish.

Imagine cast member 1 is a bitmap of a wall. Each round of the game, I need to
place the wall on stage. Additionally, I need to use a different cast member
(hole.bmp) to punch 3 to 5 holes through the wall image on the stage. Each
round will be different, so I thought that I needed to duplicate the wall every
time, otherwise the cast member itself would have more and more holes cut out
over time. I need a fresh wall each round.

There is a .zip file here (www.blueapplestudio.com/Director/GenerateMask.zip)
containing a Director file with my setup. If one of you could take a look at
the code and give me some advice I'd appreciate it.


*Not trying to cross/double post. Both threads were started with two
different questions in mind.


From: Production Monkey on
You can lead a horse to water, but you can't make 'em drink.
From: adam on
Production Monkey-

I do appreciate your assistance, and though I didn?t mention it I have tried
working with the script you posted.

The script you posted successfully delivers a union of the two images, but
what I would like to do is use one image?s alpha to subtract area from another
image. Attached is the code I altered to try and achieve this.

Sincerely not trying to make anyone do my homework here.

-Thirsty Horse


--//Below are the three approaches I tried

--------------------------------------------------------------------------------
-----
--This is the original method posted, and succesfully delivers a union of
the two images.
-- create a new alpha
TempAlpha = image(TempImage.width, TempImage.height, 8, #grayscale)
TempAlpha.copyPixels(pAlpha, DestRect, pAlpha.rect)

--------------------------------------------------------------------------------
-----
--Here I am trying to use a mask to create the punch-out effect...
-- create a new alpha
TempAlpha = image(TempImage.width, TempImage.height, 8, #grayscale)
newMatte = Member(3).image.createMask()--mask created
TempAlpha.copyPixels(pAlpha, DestRect, pAlpha.rect, [#maskImage: newMatte])

--------------------------------------------------------------------------------
-----
--...and here we are trying a matte.
-- create a new alpha
TempAlpha = image(TempImage.width, TempImage.height, 8, #grayscale)
newMatte = Member(3).image.createMatte()--matte created
TempAlpha.copyPixels(pAlpha, DestRect, pAlpha.rect, [#maskImage: newMatte])

--------------------------------------------------------------------------------
-----

From: Production Monkey on
Thirsty Horse,

Good to hear from you.

I believe you are over thinking this and perhaps missed an important line of
code from my behavior - "setAlpha()".

"setAlpha()" is all you need to punch some holes in a picture. Using your
Director, file the code would be:

member("capsule").image.setAlpha(member("mask123").image)

The caveat being that member("mask123") needs to be an 8-bit grayscale image
with exactly the same dimensions as member "capsule".

Let me know if that helps.

From: adam on
Production Monkey,

That is what I was looking for. Thanks for your, and everyone else's, assistance and patience.