GetTextExtent
hi guys,
I've getting different results on different computers
dependant on if the computer has the font installed even though I'm
embeding the font in the swf?
i.e using the code below, if you publish the .swf it works.
If you then unistall the font (PC) and run the .swf the text is
cropped ;( can someone confirm if computer need the font installed
to used the method even if the font is embeded in the .swf?
Thanks but:
"Sure I could specify number of chrs, but it's not pixel
perfect."
I need a simple function that shortens the string according
to a set width. Actually calculating the exact pixelwidth of both
String and textField. Just like getTextExtent used to do.
Yes there are workarounds, some not so exact like basing it
on chr number, or an awkward loop. I really wonder why this
function has been removed from the AS3 library? And what people use
in place?
Similar Messages
-
Linking Dynamic text boxes?
Hi there,
This might be straight forward, but I would like to know how could one link dynamic text boxes so that the information would flow? In a way, the information would flow from:
(XML) Input A into BOXA00, BOXA01, BOXA02, BOXA03, etc.
(XML) Input B into BOXB00, BOXB01, BOXB02, BOXB03, etc.
(XML) Input C into BOXC00, BOXC01, BOXC02, , BOXC03, etc.
Any takers?Hi i recently have made a function that can calculate the amount of text that will fit into a specified text box. See my attached file. Notice that the box will only accommodate the text in red since that is the maximum it can display.
"This here one is a very very very long long long text that cannot really fit completely into this box so we will have to cut it at some index point"
My function getTextExtent will return an object with properties
nIndex -> which determines the index at which the text will be delimited
fExceeded -> is true if the text is longer than the allocated height of the text field. -
Autoheight of a dynamic textbox
Hi,
I have this script which reads the xml and creates a list of
article titles and descriptions. The problem is that I can't figure
it out how to tell Flash/AS that the distance between two titles
depends on the height of a title textbox and description textbox. I
have this line I'm playing around but I have no idea what to do.
var item_mc =
menu_mc.attachMovie("menu_item","item"+item_count, item_count);
item_mc._y =(item_count * (item_mc.info_txt._height +
item_mc.main_btn._height));
var previtem = item_count-1;
item_mc._y =(previtem._y + previtem._height);
item_count++;
If I use
item_mc.info_txt._height = 100;
it works, but if I use
item_mc.info_txt._height = autoSize;
it's not working
THXUsing getTextExtent() may be helpful in your case. This
method is good for measuring the distance between 2 textfields. In
the livedocs it mentions that this method has deprecated, this is
incorrect, it is still being used today. In Flash hit F1 and search
“getTextExtent”. -
Dynamically created textfields problem
Hi people,
I have a strange problem here: I want to create textfields
dynamically that are just big enough to hold the text to display.
The textfields use a font from the library. I get the metrics of
the text with TextFormat.getTextExtent(), it seems to work ok.
However, the last letters of the text are missing in the textfield
after assigning the text, when the text needs more than 1 line. The
textfield is sized for 2 lines, but the 2nd line is just empty. I
applied wordWrap, but the text doesn't show at the 2nd line. This
seems to be connected to the font that is used: I tested about a
dozen different types, and only 1 of them displays always the full
text, with all other fonts, the last 6 or so letters are missing.
The text property of the textfields holds the complete text; where
are the last letters?
So, are there any known issues with textfields created
dynamically? Or any trick to display all of the text? I'd like to
use a monospaced font, but all I have tested have this strange
problem.
Attached is the code used for creatiing the textfields.
blemmoYep, the reason is I never tried that. :)
No... I'm just about to give it a try, but I want to draw a
fancy border around the textfield (other than the border that comes
with the textfield), so I guess I'll need the metrics info anyway.
Another thing is that I want the width to be not more than 150,
gotta check if that's possible with auto-size. Have to try that
now... thx for the input!
blemmo -
My function not working good...
Solve it.
Thanks anyway.I check that trace before the change you told me to do, and
after it.
Before:
etterSpacing: null
kerning: null
display: block
bullet: null
tabStops: null
blockIndent: null
leading: null
indent: null
rightMargin: null
leftMargin: null
align: null
underline: true
italic: false
bold: false
target: null
url: null
color: 0
size: 8
font: arial
getTextExtent2: [type Function]
getTextExtent: undefined
letterSpacing: null
kerning: null
display: block
bullet: null
tabStops: null
blockIndent: null
leading: null
indent: null
rightMargin: null
leftMargin: null
align: null
underline: false
italic: false
bold: true
target: null
url: null
color: 0
size: 8
font: arial
getTextExtent2: [type Function]
getTextExtent: undefined
After:
letterSpacing: null
kerning: null
display: block
bullet: null
tabStops: null
blockIndent: null
leading: null
indent: null
rightMargin: null
leftMargin: null
align: null
underline: false
italic: false
bold: false
target: null
url: null
color: null
size: -2147483648
font: null
getTextExtent2: [type Function]
getTextExtent: undefined
letterSpacing: null
kerning: null
display: block
bullet: null
tabStops: null
blockIndent: null
leading: null
indent: null
rightMargin: null
leftMargin: null
align: null
underline: false
italic: false
bold: true
target: null
url: null
color: 0
size: 8
font: arial
getTextExtent2: [type Function]
getTextExtent: undefined
1) The before look Ok and if you remember it did change the
last Content.
2) I not realy understand in trace of textformat so I will
wait for your reply.
Thank you.
Maybe you are looking for
-
adding pages to web site......links work in iWeb, but inactive when viewing published pages........on iWeb 9.0.3........any suggestions would be greatly appreciated.......thank you
-
Fix for "Duplicate file name was specified"
Bonjour, impossible d'installer Itunes ..."un nom de fichié dupliqué a été spécifié"...que faire? j'ai déjà désinstaller itunes (dans le bon ordre avec ses 5 composants..." UNe solution SVP ?????merci
-
Solaris 10 x86, Linux binairy compatiblity
Where is the feature ? How does it works ? Where can I find documentation ? Sun is announcing this new feature with all its big Solaris 10 marketing but I can't find anything technical about it . Do you have an idea ?
-
Photostream uploads photos automatically even on mobile cellular connection?
i have installed photostream on ipad 3 v 5.1.1 and windows 7. ( Ignoring the problem that my ipad chooses to use up my mobile data card even when i am in the house with my broadband wifi connection ) I just took a picture with the ipad on cellular
-
How to stream images to an iPad ?
I am a photographer and want to stream images as I shoot them into a Macbook Pro to an iPad (for an Art Director). Shooting tethered into Aperture or Capture One. But can set up a 'hot folder'. Gernerally in a studio or location house with wifi. Need