dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Text bold on button click

  1. #1
    SDDesign Expert
    Join Date
    May 2004
    Location
    Bangladesh
    Posts
    45

    Text bold on button click

    I have an input text box. Some text in it. There is a button .
    I want that when i click the button the writing in the input text box will become bold.
    in a seperate inout box:
    I want that when i click the button the writing in the input text box will become italic.

    Are these possible??
    www.SDDesign.Biz >> Themeing At its best.
    All Images are Drawn With SwishMax.

  2. #2
    Member
    Join Date
    Apr 2004
    Posts
    52
    you could do it be creating a srpite with the first two frames having the stop action, then have the bold or italic text were you want it, and add remove under the stop action, then place under te second stop action. ten you add an action like onpress tell target name of sprite" play and the text will appear, but then you have to create a second tell target action to play which would make the text that was originally thre disappear, you have to edit it to fit your own needs. there might be easier ways of doing this but this is jst wut i could think of at the time

  3. #3
    SDDesign Expert
    Join Date
    May 2004
    Location
    Bangladesh
    Posts
    45

    Wont help..:(

    thanks for the reply. But thats something that i had already thought of ages ago..and that does NOT work. supose i have "text" in the input field of the box. i can make a sprite that will make "THIS" text go bold or italic using sprite but not the text inoutted by the user as i can NOT assign a value to the text to covert it to bold. as far as i have heard from all the PROS of swish that this CAN NOT be done...well people might be wrong...can you find one way?
    www.SDDesign.Biz >> Themeing At its best.
    All Images are Drawn With SwishMax.

  4. #4
    SWiSHer extraordinaire
    Join Date
    Dec 2000
    Location
    Australia
    Posts
    3,900
    Here is an example (must test in player or browser to do it .. will not work in internal player:

    here script for button that toggles bold on/off for text field called 'mytext' is

    on(release) {
    bold = ! bold;
    myTextFormat = new TextFormat();
    myTextFormat.bold = bold;
    mytext._text.setTextFormat(myTextFormat);
    }
    Attached Files Attached Files
    Roger Onslow - SWiSHmax: its here!

  5. #5
    SDDesign Expert
    Join Date
    May 2004
    Location
    Bangladesh
    Posts
    45
    thnak you very much roger for the swi file that you addedd. all the problems are solved. now i may ask a stupid thing..if i want to make the texts italic do i do this?


    on(release) {
    italic = ! italic;
    myTextFormat = new TextFormat();
    myTextFormat.italic = italic;
    mytext._text.setTextFormat(myTextFormat);
    }


    ??? is this the way?

    nd..what if i want to do both at the same time? can that be done?
    www.SDDesign.Biz >> Themeing At its best.
    All Images are Drawn With SwishMax.

  6. #6
    Chief of Molecules wcoleman's Avatar
    Join Date
    Nov 2000
    Location
    Massachusetts
    Posts
    3,975
    This code would change both the code and italic attributes:

    on(release) {
    italic = ! italic;
    bold = ! bold;
    myTextFormat = new TextFormat();
    myTextFormat.italic = italic;
    mytextformat.bold = bold;
    mytext._text.setTextFormat(myTextFormat);
    }

    This assumes both attributes are either on or off.

    Cheers,

    Flick

  7. #7
    Senior Member Lys12's Avatar
    Join Date
    Feb 2001
    Location
    Munich, Germany
    Posts
    5,237
    i played around a bit:

    http://www.msnrd.de/font_properties.html
    Attached Files Attached Files

  8. #8
    SDDesign Expert
    Join Date
    May 2004
    Location
    Bangladesh
    Posts
    45
    thnak you very much guys...nd Lys12 cool dude...(Y)..:d thnakz all ciao..
    www.SDDesign.Biz >> Themeing At its best.
    All Images are Drawn With SwishMax.

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