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? C开发者_运维知识库an I control quality?
Are there any scaling going on? Try Bitmap smoothing:
myBitmap.smoothing = true;
- Make sure the png is of good quality;
- Check if you don't modify
spinner
width, height, scale, filters; - Place it on even position, that is
x = 50
notx= 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?
精彩评论