TwelvestoneFlash

determining height of dynamic text field


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
oregondave
 
2010-08-03

i've got a multiline dynamic text field - its height is being determined by the amount of text being retrieved using:

titleText.width = 335 titleText.autoSize = true

but the height of the physical MC on the stage is the default 20 pixels - so if i try to trace it's height at runtime i get the default 20 instead of the dynamic new height

how would i go about tracking the dynamic height?

Storm
 
2010-08-03

try making the text SUPER LARGE (so that it goes over 20px) and see if you get a value >20. Perhaps it reports the TextField as its DisplayObjectContainer's height unless it forces the MC to be higher for more text.

It will at least help narrow down what the issue is. Maybe TF.height fills it's DOC with autosize=true???

oregondave
 
2010-08-03

interesting ...

set text to 24 point ...

trace output is 34 - although the textfield has _*obviously *_expanded past a height of 400 ...

Storm
 
2010-08-03

that narrows it...it has to do with the display object container then.

what does titleText.textHeight report?

oregondave
 
2010-08-03

you. are. a. GOD.

Storm
 
2010-08-03

nope, I only know how to troubleshoot Flash from years of teaching.

But thank you anyway. k

oregondave
 
2010-08-03

Originally posted by: Storm

what does titleText.textHeight report?

titleText.textHeight == 16

titleText._height == 20

Storm
 
2010-08-03

you're good to go then? getting what you need?

oregondave
 
2010-08-03

nah ... still can't find a solution for getting the actual height as opposed to the default static height of the textfield on the stage

still working on it but no love so far ... :(

Storm
 
2010-08-03

autoSize is a Boolean....'true' is an error. Is this As2?

My thought is textHeight might only be per line so multiline might not report a height.

ok....AS3..... if it is truly multiline then the textHeight is a dynamic read-only variable you can access.

oregondave
 
2010-08-03

yep - unfortunately 'tis AS2

and it's only reporting single line height - even though the field is expanding to fit text content properly ... it's almost like it's reading the height val prior to the field being populated.

i think it's a lost cause - there's a few dozen ways to accomplish what i need to do - unfortunately all of them involve trashing a lot of my coworker's noble attempts & hard work toward a 'one size fits all' solution :(

JLM
 
2010-08-04

Oregondave

height is a bit buggy. Doing stuff like setting it to itself and tracing its value can force flash to update.
Also html sometimes make its internal calculations wrong. Have you tried getting the bounds of the holding movieclip after first trying to force flash to resolve the height value of the textfield.

If you get really stuck create a cut down version and I will take a look, its really only down to using the correct smoke and mirrors, while not sure I have any useful code still around it is the sort of thing I have had to solve many times.

Cheers

;j

oregondave
 
2010-08-04

thanks JLM - i went ahead and used an alternate approach - it's something we will likely reuse several dozen times in the near future, so i really need a straight forward, near bulletproof, user agnostic method of reconciling the issue - my approach works just fine for now - only not quite as 'automatic' as he'd hoped k

if we get stuck and need to go back and fully resolve this i'll def let you know.

thanks again & thank you Storm for your help & for playing post tag for a while there k

Storm
 
2010-08-04

glad you got something going. I was done work and playing hockey last night (4 goals thank you!!) so I feel bad I couldn't help more.

oregondave
 
2010-08-04

you've helped me plenty over the years - trust. k

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

determining height of dynamic text field