jayarjo
jayarjo

Reputation: 16726

Why embed PNG in Action Script looks pixelated when added to a stage?

Here is what I do:

 package
{
    import flash.display.Bitmap;
    import flash.display.Sprite;

    public class Loading extends Sprite
    {
        [Embed(source="loading.png")]
        private var MyLoading : Class;
        private var spinner:Bitmap;
...

        public function MoxieLoading(center:Point)
        {           
            spinner = new MyLoading;
            addChild(spinner);
...

And when my loading png finally appears it looks like a poorly indexed GIF, especially on edges. Why is it happening? I'm using Bitmap class here, maybe there is something better? Can I control quality?

Upvotes: 0

Views: 1904

Answers (2)

Maurycy
Maurycy

Reputation: 1322

  1. Make sure the png is of good quality;
  2. Check if you don't modify spinner width, height, scale, filters;
  3. Place it on even position, that is x = 50 not x= 50.5;

But overall it seems like a problem with the actual picture, not flash. I never ever had any problems with embeded PNGs, maybe the program in which you saved it did it in some funky way?

Upvotes: 1

Mattias
Mattias

Reputation: 3907

Are there any scaling going on? Try Bitmap smoothing:

myBitmap.smoothing = true;

Upvotes: 3

Related Questions