1

I think that Tweener is not using fractions of pixels on x,y movement, but that exactly what I need. I read about rounded parameter (default:false), that would round pixels, to reduce problems with text, but I want to slowly pan an loaded image, so I don't want to use a rounded value. My code:

var bmp = Bitmap(loader.content);
bmp.smoothing = true;
Tweener.addTween(loader, {x: 20.0, time:10, transition:"linear"});

Image smoothing works fine, but it slides choppy. It looks like moving 1 pixel at seldom frames, not some fraction of px per frame. I'm considering that flash image smoothing has to deal with fraction of pixels. I searched over stackoverflow, and all I could find was about image smoothing, and not about x,y movement smoothing.

Thanks in advance.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Pedro Guglielmo
  • 119
  • 1
  • 4
  • Is this even possible? (I'm not sure). I've always thought of a pixel as 1 light.. You can't light up 1/4 of a globe..? – Marty May 13 '11 at 07:07
  • Try tracing your `loader.x` values in an `enterFrame` to confirm that. I've never experienced such a behavior. – DanielB May 13 '11 at 07:27
  • Used DanielB idea and trace(loader.x) looked like: -108.57266666666666 and -140.648, so I'm assuming that is not Tweener problem, not even the loader, it seems the bitmap loaded problem, like Jordan pointed out. – Pedro Guglielmo May 15 '11 at 06:09
  • @Marty Wallace, you can have 1/2 pixel in this sense: one original image of one black point moving 1/2 pixel, will be two grey points, as if the point was in between those pixels. I think that is a anti-aliasing effect [link](http://en.wikipedia.org/wiki/Anti-aliasing). So moving an image with subpixels will give a smooth movement. – Pedro Guglielmo May 15 '11 at 06:27

3 Answers3

0

If loader.content contains a Bitmap instance, that is your problem. Bitmap automatically snap to a full pixel unlike MovieClip and Sprite. You can change this behavior by setting the pixelSnapping property.

Jordan
  • 1,233
  • 2
  • 12
  • 32
  • Edited my class as this: var bmp = Bitmap(l.content); bmp.smoothing = true; bmp.pixelSnapping = PixelSnapping.NEVER; Still some problem. Do I have to use my bmp on stage, or the loader is fine? Maybe this is happening because I using a mask over the loader? – Pedro Guglielmo May 15 '11 at 06:09
  • Yes if your setting the properties of your bmp instance, use that instance, not the loader just for readability. Why the tween is choppy I can't say. You should probably try setting up a stand alone test with this tweener and a bitmap to eliminate the possibility of the tweener causing the problem. – Jordan May 16 '11 at 03:50
  • I will try to create a simple file to emulate the error and reply here. – Pedro Guglielmo May 20 '11 at 00:42
0

If it's choppy only on certain, infrequent frames, it could be the garbage collector doing a sweep in the middle of your movement and causing a slight stutter in performance.

0

I solved this by changing x,y movement to a scaleX and scaleY "movement". As I was using a mask over a big photo, it looks like moving when I scale the photo, but it actualy is scaling.

I know this is not a good answer, but it temporarily solved my problem, since I didn't realy now why in this specific case x,y movement was not smooth. Maybe helps someone with same problem.

Pedro Guglielmo
  • 119
  • 1
  • 4