dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [F5] detect height of dynamic text box

Hybrid View

  1. #1
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831

    [F5] detect height of dynamic text box

    Hello flashies!!

    I am working in flash 5 due to some specific requirement. I have one file which was earlier created in MX. A dynamic text box was used. Some text was inserted in the text box dynamically and then the height of text box was calculated using the textHeight property for further placing other items below the text box.

    Now when I am using the same file in Flash 5 I dont have the textHeight property availaible as it was in MX. Can anybody here tell me the trick to calulate height of this text field after the text is insterted in it.


    As ever,
    Vinayak
    Last edited by vinayak.kadam; 05-19-2008 at 05:31 AM. Reason: Made my query more precise to understand!

  2. #2
    http://www.in3d.eu Kostas Zotos's Avatar
    Join Date
    Jul 2007
    Location
    Athens - Greece
    Posts
    408
    Hi,

    Maybe use the text Field "_height" property ? (don't know if exists in F5 -it should be- or if this is what you want)
    ------------------------------

    Another possible workaround:
    Using code Create: an empty container clip, a dynamic text field inside, and then instead of tracking the text field height (because there is not an available property in Flash 5), just get the container clip height..

    Here is a sample AS (Requires a button on stage named "myButton", when press the button, the text updated, and the new height shown in the Flash output window):
    PHP Code:
    this.createEmptyMovieClip("Container"500)
    Container.createTextField("TxtField"1101025050)

    with (Container.TxtField) {
        
    type "input"  //OR: "dynamic"
        
    border true
        wordWrap 
    true
        multiline 
    true
        autoSize 
    true
        text 
    "Initial Text \n\nNeed a button on stage named: \"myButton\" \n\nWhen press the button, you will see the new text here and the textField height (in the Flash output window) \n\n(SEE THE FLASH OUTPUT WINDOW)"
        
    ShowHeight()
    }

    Container.TxtField.onChanged ShowHeight

    myButton
    .onRelease = function() {
        
    Container.TxtField.text "This is an input text field. \n\nYou can insert or delete some text in order to see the new height... \n\n(SEE THE FLASH OUTPUT WINDOW)";    
        
    ShowHeight()
    }

    function 
    ShowHeight(){        
        
    trace("Height: "+Container._height+" pixels")

    Note: I don't know of course if the commands to dynamically create a movie clip and a text field (as well as some other properties) are available in Flash 5..

    Regards!

    Kostas
    K. Zotos online portfolio: http://www.in3d.eu

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    good try Kostas, but -

    In Flash 5, the text property didn't exist, nor did the TextField Class. In order to read from, or assign content to a dynamic text field you would use the Var: of the text field.

    also createEmptyMovieClip, onRelease and onChanged did not appear until Flash 6.

    does this thread posted in 2002 help?

    http://friendsofed.infopop.net/2/Ope...3&m=2513092976

  4. #4
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831

    [F5] detect height of dynamic text box

    Hey,

    the thread you posted from 2002 was excellent and worth reading... I guess life is so easy now...

    Anyways, I had tried several options but now reached to a conclusion that what I want to do is does not has any workaround.

    What I wanted to do is I had to determine the height of one text field and then accordingly I have to place another text box below it with some offset and I have to keep repeating this for 4 times... We niether have the autosize property...

    Anyways life needs a compromise some where niether I can recoup the time I am putting for this foolish text field thing.....

    Thanks guys and thanks once again for that excellent thread!!!

    As ever,
    Vinayak

  5. #5
    http://www.in3d.eu Kostas Zotos's Avatar
    Join Date
    Jul 2007
    Location
    Athens - Greece
    Posts
    408
    Thank you! a_modified_dog (useful info)

    Quote Originally Posted by vinayak.kadam
    I guess life is so easy now...
    Sure.. Life (with newer versions of Flash) is now much easier

    Bye!
    K. Zotos online portfolio: http://www.in3d.eu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center