Groups | Blog | Home
all groups > flash actionscript > december 2006 >

flash actionscript : Text Bounding Box


oddys
12/20/2006 8:25:33 PM
Hello,

I am having a problem with founding out the x and y position of dynamic text.
I have a flash movie which allows users to type out some text, change font,
size, bold, italic etc and then move it around within a restricted area. The
users then save their design which saves all the information about there design
in a database.

The problem is the x and y position of the text saved in the database is
actually the x and y position of the bounding box which is quite a way out from
the actual text. This causes a lot of problems when trying to re-create their
design using a different system. This also causes problems as the difference
between the x and y of the bounding box and the actual x and y differs
massively between different fonts and sizes etc.

Basically I have to find out the actual x and y of the text and not the
bounding box. I have noticed actionscript 3 has a feature which would solve all
my problems but obviously this is no good for me now as I need my movie as
accessible as possible.

I have a feeling there is no straight forward answer to this question but I
seriously need some sort of solution to this problem.

Thanks in advance
Steven

cinemaguy
12/20/2006 8:58:25 PM
oddys
12/20/2006 9:30:36 PM
Hi,

Cheers for your reply, this sounds interesting, I take it the textWidth and
textHeight give the actual text width and height and not that of the bounding
box.

This would allow me to find out what the total margin is around the text
before the bounding box but i will not know how much of it is on the top and
how much is on the bottom because the text is not always in the middle of the
bounding box, it moves up and down between fonts.

Any other suggestions?

Thanks again,
Steve
AddThis Social Bookmark Button