Flash tip of the day
Flash tip of the day
Out of context: Reply #10
- Started
- Last post
- 47 Responses
- gabadilla0
When you're centering a container movieclip to stage, you'll often end up on a "half pixel" if the stage size is an odd number. This will blur pixel fonts and any other perfect pixel elements with the container mc. I've found that the easiest way to keep it on the whole pixel is to use Tweener's built-in "rounded" option. There are other ways to do this using Math but this is a simple one line solution.
Here's an example of the code in use:
Tweener.addTween(container, {x:stage.stageWidth/2-container... time:0, transition:"linear", rounded:true});- that should say: container.width/2gabadilla
- TweenLite!!!rosem
- I usually Math.round the x/y.funkage
- Just round the destination first, and make it a variable. It's faster than having Tweener do the calculation for you.NONEIS
- This is a one line of code solution. Of course there are other ways to go about it.gabadilla
- Sometimes I like to tween it to it's new position too instead of just snapping it, so this also allows for that.gabadilla
- its not it'sgabadilla