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 <[email protected]>wrote:

> 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 <[email protected]
> >wrote:
>
> > 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 rectangle object for each char in an array and then
> >> cycled through the array as Glen suggested.
> >>
> >> Only thing is, when I use a multiline textfield my function will only
> >> gather
> >> the char boundaries for the first line:
> >> If anyone can suggest why it would be a help.
> >> Cheers!
> >> Ali
> >>
> >>
> >>
> >>
> >> public static function letterPosAr(t:TextField):Array
> >> {
> >> trace("letterPosAr");
> >> var retA:Array = new Array();
> >> for (var i:int = 0; i < t.text.length; i++){
> >> var rect:Rectangle = t.getCharBoundaries(i);
> >> trace("---index"+i+"  char:"+t.text.substr(i, 1)+"  x:"+rect.x+"
> >> y:"+rect.y+" w:"+rect.width);
> >> retA[i] = rect;
> >> }
> >> return retA;
> >>  }
> >>
> >> On Tue, Feb 24, 2009 at 7:02 AM, Matt Gitchell <[email protected]
> >> >wrote:
> >>
> >>
> >>
> >>> the AS2 one is a cool idea!
> >>>
> >>> On Mon, Feb 23, 2009 at 10:16 PM, Hans Wichman <
> >>> [email protected]> 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 <
> [email protected]
> >>>>
> >>>>
> >>>>> 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/interactive/m/textcompare.html
> >>>>>
> >>>>> --Matt
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Mon, Feb 23, 2009 at 3:01 PM, Glen Pike <
> [email protected]
> >>>>>
> >>>>>
> >>>>>> wrote:
> >>>>>>          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 through the array each timer increasing the x position of
> >>>>>>
> >>>>>>
> >>>>> the
> >>>
> >>>
> >>>> letters, removing them when they reach the other side???
> >>>>>>    Something like that??/
> >>>>>>    Glen
> >>>>>>
> >>>>>> ali drongo wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> 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 I don't know how to calculate the position of each letter.
> >>>>>>>
> >>>>>>> Any ideas very gratefully received!
> >>>>>>>
> >>>>>>> Thanks :)
> >>>>>>> Ali
> >>>>>>> _______________________________________________
> >>>>>>> Flashcoders mailing list
> >>>>>>> [email protected]
> >>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>> --
> >>>>>>
> >>>>>> Glen Pike
> >>>>>> 01326 218440
> >>>>>> www.glenpike.co.uk <http://www.glenpike.co.uk>
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> Flashcoders mailing list
> >>>>>> [email protected]
> >>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> _______________________________________________
> >>>>> Flashcoders mailing list
> >>>>> [email protected]
> >>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>>>>
> >>>>>
> >>>>>
> >>>> _______________________________________________
> >>>> Flashcoders mailing list
> >>>> [email protected]
> >>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>>>
> >>>>
> >>>>
> >>> _______________________________________________
> >>> Flashcoders mailing list
> >>> [email protected]
> >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>>
> >>>
> >>>
> >> _______________________________________________
> >> Flashcoders mailing list
> >> [email protected]
> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >>
> >>
> >>
> >
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to