title: PNG with transparency from Photoshop to Flash: how to make .swf display exactly what .psd does?
body: <p>I have two layers in Photoshop: 1 -- a texture, 2 -- a semi-transparent image that overlaps texture. The combination of the two looks nice in Photoshop. I export them separately from Photoshop saving them as 24 bit PNG with transparency and colors converted to sRGB. (Working color space of PS is sRGB.) </p>
  
  <p>The result of importing them into flash makes me cry (see images below, note what areas around crosses look like). :( </p>
  
  <p>I tried both loading PNGs dynamically and directly importing them into fla (compression type: lossles, allow smoothing: false). Looks like semi-transparent areas are saved inacurately on export. What's more puzzling to me is why the results differ between dynamic loading and direct importing.</p>
  
  <p>What am I missing? In-depth explanation of these symptoms would be highly appreciated.</p>
  
  <hr/>
  
  <p><strong>EDIT1</strong> Here is that psd I'm stuck upon. Inside the zip you'll find <strong>transparency.psd</strong>, which has only two layers. I still have no luck in placing them into fla: transparent areas get dirty.</p>
  
  <p><a href="http://noregret.org/test/transparency.zip" rel="nofollow noreferrer">http://noregret.org/test/transparency.zip</a> (400 kb)</p>
  
  <hr/>
  
  <p><strong>EDIT2</strong> A fellow flash developer pointed me to "<strong>premultiplied alpha problem</strong>".</p>
  
  <p><a href="http://en.wikipedia.org/wiki/Alpha_compositing#Description" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Alpha_compositing#Description</a></p>
  
  <p>I think this must be the problem I'm trying to overcome.</p>
  
  <p>As far as I know by now, Photoshop internally uses straight alpha (premultiplying with white on PNG export) and <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#getPixel%28%29" rel="nofollow noreferrer">Flash uses premultiplied alpha</a>. But I still don't get it: what yields the difference in rendering of transparent images? And I still don't know exactly what operations I need to perform to get things look the same in PS and Flash (or at least how do I instruct our artists on preparing the images). </p>
  
  <p>Anyone? I'm continuing to dig Google for the answer.</p>
  
  <hr/>
  
  <p><strong>EDIT3</strong> Unfortunatelly, <strong>I can't flattern image</strong>. This example here is just a small part of a bigger picture. I have a rather complicated interface with a lot of semi-transparent elements on top of a texture. The picture looks cool (like it's made of crumpled cardboard or something). So, I need a texture and semi-transparent layout separately. Adding blendmodes to top layer in flash does solve "the ghosting areas" problem, but it also significantly changes the picture, which is not acceptable.</p>
  
  <hr/>
  
  <p>Semi-transparent layer:</p>
  
  <p><img src="https://i.stack.imgur.com/z3tWq.png" alt="enter image description here"></p>
  
  <p>Texture layer:</p>
  
  <p><img src="https://i.stack.imgur.com/Gf10E.png" alt="enter image description here"></p>
  
  <p>Results (screenshots of PS and Flash Player on Windows):</p>
  
  <ul>
  <li>Photoshop(original): <strong>Ok</strong></li>
  <li>Flash (import to fla): heavy ghost area</li>
  <li>Flash (png loading): light ghost area</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/PgcVP.png" alt="enter image description here"></p>