Note that there are some explanatory texts on larger screens.

plurals
  1. POImage object white background showing
    primarykey
    data
    text
    <p>I have an Image object that gets resized to the containers size when the image loads.<BR/> The images that it will load are dynamic in size so after resize I end up with a sliver of the image object's white background showing.<BR/> <BR/> How can I make the Image object not have a white background and be transparent.<BR/> Parts of the PNG's have transparent parts but show up as white due to the white background of the object is it loaded into.</p> <pre><code>&lt;mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" headerHeight="20" &gt; &lt;mx:Script&gt; &lt;![CDATA[ public function set source( val:String ):void{ this.img.source = val; } private function onLoad( e:Event ):void{ // resize image on load to fit var scale:Number = (this.height - 38) / this.img.contentHeight; // 38 is adjustment for headheight and padding this.img.scaleX = scale; this.img.scaleY = scale; } ]]&gt; &lt;/mx:Script&gt; &lt;!-- how do I make this image object have a transparent background --&gt; &lt;mx:Image id="img" complete="onLoad(event)" /&gt; &lt;/mx:Panel&gt; </code></pre> <p>[EDIT] In the screen shot visible are 2 of the objects made from the code I posted above.<BR/> As you can see there is a white border.<br/> <img src="https://i.stack.imgur.com/Kh6Qu.png" alt="enter image description here"></p> <p><br/> <br/> and here is one of the PNGs<br/> This png has a transparent 1 inch border at 350@PPI this is 72 PPI So a tad smaller<br/> You can not see the the border here obviously but if you drag it to your desktop and open in photoshop you will see it<br/> <img src="https://i.stack.imgur.com/sJa1u.png" alt="enter image description here"></p> <p>[EDIT]<br/> As SuperSaiyen suggested I added backgroundColor="#000000" to the panel and I got this result. As you can see I got a black border now.<br/> <img src="https://i.stack.imgur.com/0ZtiI.png" alt="enter image description here"></p> <p><br/> So i went ahead and added backgroundAlpha="0" along with backgroundColor="#000000" to the panel and got this.<br/> <img src="https://i.stack.imgur.com/YFjsV.png" alt="enter image description here"> <br/> So now I almost have it but there is still that bluish color around it. Its not quite 100% transparent yet.<br/> I really have no idea why the panel background would change the image tag.<br/> I guess some kind of inheritance from the parent is going on.<br/> Still need to get rid of the blue.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload