views:

488

answers:

2

I'm having a hell of a time trying to get a custom mask to work on a project I'm creating.

The mask I'm trying to use is applied as a pixel mask on a layer in the photoshop doc I'm working off, but I can't seem to figure out the proper way to get that layer mask imported into flash, to then compile into my .swc and be called from actionscript. (I'm coding in Flex)

Whats the proper workflow for getting a pixel mask imported from photoshop so that when I call:

container.mask = myMask;

It'll show up as the shape I want, and not just a square box the size of my shape?

Thanks in advance, this is driving me batty!

A: 

I think the problem is masks in photoshop have a white background and masks in flash need a transparent background so when you copy it over flash just sees it as one big rectangle.

I am not sure if this is the best approach but you could crop the actual area that you want and then paste it in as a layer into flash just above the images you want to mask. Then right click on the layer in the timeline and select mask. Of course if your mask has gradients it may just be easier to remake the mask in flash.

Allan
+2  A: 

You'd have to convert the mask shape in Photoshop to a vector shape, then import that vector into Flash.

In Photoshop:

  • Click on your mask's thumbnail in the Layers palette.
  • In the Channels palette, click the mask's channel then click the "Load channel as selection" button at the bottom of the palette.
  • Open the Paths palette, then click the "Make work path" button. This will create a vector path of the mask area. Click the newly created path in the Paths palette. You will see the path in the document window.
  • Select the Path selection tool (the black arrow), then click the path. You'll know it's selected when you can see the edit handles on the path. Right-click on the path and select Define Custom Shape, then give the shape a name.
  • Create a new layer, then select the Custom Shape tool. Select the shape you just created from the Shapes menu in the toolbar at the top. Click the menu arrow next to the Shape tools to view the Custom Shape Options window. Click the Defined Size radio button.
  • Click inside the window to place your shape. It doesn't matter what the fill color is, since you're just doing this to import the shape layer you just created in Flash.
  • Save the PSD file.

In Flash:

  • Choose File->Import->Import to Library then find the PSD file you just saved.
  • In the Flash import settings window, click the shape layer you created in Photoshop. Under "Import this shape layer as:" select "Editable paths and layer styles". Click OK.
  • Flash will create an assets folder in the library with all of layers you imported. In that assets folder, you'll see a symbol with the name of the custom shape you created in Photoshop. Open that symbol and you'll see a box with the fill color you used in Photoshop, but there's also a mask layer. That mask layer is the vector shape of your mask. Convert that to its own symbol. You can now use that symbol as a mask.
wmid