If the sprite.x is not an exact round number (so not an correct integer)
wouldn't that throw an error???


-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri
Heitlager
Sent: woensdag 17 december 2008 15:11
To: Flash Coders List
Subject: Re: [Flashcoders] Pixel precise

Casting to int is faster.

var tX:int = int(sprite.x)

Jiri

jonathan howe wrote:
> Hi, Laurent,
> 
> You could use localToGlobal(), apply Math.round() to this global point,
> compare the original global point with the rounded version, and then
offset
> the child's coordineates by the differences.
> 
> Caveats are:
> - if you do this multiple places in a display hierarchy, you'd need to
work
> from the bottom upwards.
> - during animation you're bound to introduce a certain amount of
jumpiness.
> 
> On Wed, Dec 17, 2008 at 8:39 AM, laurent <laur...@logiquefloue.org> wrote:
> 
>> Hi,
>>
>> Is there a way to be sure elements are positionned précisely on a Pixel ?
>>
>> I have a sprite containing sprites that are positionned on integer
>> coordinates so they are pixel positionned.
>> And this sprite is re-positionned when the window resize, so I used int()
>> to be sure I got x and y as integers but still the content get blury
>> sometimes.
>> Is there something to do that flash always position element on a pixel
not
>> a pixel and half...?
>>
>> thx
>> L
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
> 
> 
> 
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.176 / Virus Database: 270.9.19/1853 - Release Date: 17-12-2008
8:31


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to