[Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-23 Thread ali drongo
Hi there, I'm animating some letters that are dynamically created in their own sprites across the screen as if they are being fired in a stream. Currently I am using a fixed width font so it's straight forward to find their final position. My problem is that I need to use a non fixed-width font and

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-23 Thread Glen Pike
Hi, You should be able to get the width of each sprite with the single letter in??? Maybe mask the stream area out. Start each letter at x - letterWidth, increase the x after each interval, when the letter reaches x=0, create & show the next one, add it to your array. Loop throu

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-23 Thread Matt Gitchell
Is this AS3? you can use TextField.getCharBoundaries() I used it in an experiment a while back here to pretty good effect: http://www.moonbootmedia.com/interactive/m/textcompare.html --Matt On Mon, Feb 23, 2009 at 3:01 PM, Glen Pike wrote: > Hi, > > You should be able to get the width of ea

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-23 Thread Hans Wichman
and for as2: http://objectpainters.com/blog/2008/10/12/finding-character-positions/ On Tue, Feb 24, 2009 at 1:24 AM, Matt Gitchell wrote: > Is this AS3? you can use TextField.getCharBoundaries() > > I used it in an experiment a while back here to pretty good effect: > http://www.moonbootmedia.com

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-23 Thread Matt Gitchell
the AS2 one is a cool idea! On Mon, Feb 23, 2009 at 10:16 PM, Hans Wichman < j.c.wich...@objectpainters.com> wrote: > and for as2: > http://objectpainters.com/blog/2008/10/12/finding-character-positions/ > > On Tue, Feb 24, 2009 at 1:24 AM, Matt Gitchell >wrote: > > > Is this AS3? you can use Te

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-24 Thread ali drongo
Thanks for all of your responses guys,I ended up using getCharBoundaries and it works a treat. FYI I created a text field at the position I wanted the letters to finally go then stored the rectangle object for each char in an array and then cycled through the array as Glen suggested. Only thing is

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-24 Thread Glen Pike
Hi, Can you get text metrics for characters / lines in the text field??? Glen ali drongo wrote: Thanks for all of your responses guys,I ended up using getCharBoundaries and it works a treat. FYI I created a text field at the position I wanted the letters to finally go then stored the rec

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-24 Thread Matt Gitchell
TextField has a getLineMetrics() function, which returns a TextLineMetrics object. Check out the AS3 Reference stuff for TextField and the TextLineMetrics class for the breakdown, there's all kinds of good, fun stuff in there. --Matt On Tue, Feb 24, 2009 at 6:36 AM, Glen Pike wrote: > Hi, > >

Re: [Flashcoders] How to know coordinates of letters in non fixed-width fonts

2009-02-26 Thread ali drongo
Thanks guys, I got it working :) The text is slightly badly aligned sometimes, I'm going to look into Line Metrics and aliasing as it's only a pixel or so out as the text is v small.Many many thanks again Ali On Wed, Feb 25, 2009 at 7:42 AM, Matt Gitchell wrote: > TextField has a getLineMetrics