dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: txtInput ..bold

  1. #1
    Between Flash & Flashkit timothye's Avatar
    Join Date
    Dec 2003
    Location
    Sweden
    Posts
    1,666

    txtInput ..bold

    hi .
    I have a txtField on the stage as input type
    I have a button on the stage : bold_btn
    what i am trying to accomplish is when i type in txt into the input txtField and then press the button the text will appear as <B>BOLD</B> text . and ideas on how to creat this .?

    i have been playing around with this
    Code:
    //make the text Bold
    bold_btn.onRelease = function() {
    	var inputText = new TextFormat();
    	inputText.bold = true;
    };
    any help is greatly appreciated .
    Merry Christmas & a new year
    God Jul..
    Cheers T
    I want to learn .
    wannabe flasher [ Actionscript 2.0 ]

  2. #2
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Here is one way...
    Create a movieclip which has the text field on two seperate keyframes then apply bold in the properties panel to the text box on second keyframe.
    Then add stop actions to both frames and lable each of the frames.
    So that when the button is pressed ....the movie clip will then go to the frame where the text box is now bold.

  3. #3
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    This may be a bit simpler

    bold_btnr.onPress = function(){
    var inputText:TextFormat = new TextFormat();
    var temptxt = _root.txt.text;
    fmt.bold = true;
    _root.txt.setNewTextFormat(inputText);
    //_root.txt.text = temptxt;
    }

    Create the format and apply it like you thought. The trick is that you then also have to reassign the actual text for it to take effect, similar to restarting a computer after installing new software. Copy the textfield's contents into a temp variable, then apply the format to your field, then assign the temp variable back into the field.

    _b

  4. #4
    Between Flash & Flashkit timothye's Avatar
    Join Date
    Dec 2003
    Location
    Sweden
    Posts
    1,666
    thanks for the replies .
    I'll get it to work .
    Cheers T MGT
    (y)
    I want to learn .
    wannabe flasher [ Actionscript 2.0 ]

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