Dynamic font and colour changes to textbox

Ask a Question related to Macromedia Flash, Design and Development.

  1. #1

    Default Dynamic font and colour changes to textbox

    Hi NG,

    I have a movieclip called: wordcontainer
    and this clip contains a textbox called : wordtextbox

    and I can set the movieclip to display a singlr word myWord as follows

    Code:
    wordcontainer.wordtextbox.text = "myWord";


    I have found out how to dynamically create a new textformat as
    follows:

    Code:
    //create a new TextFormat object
    myTextFormat = new TextFormat();
    //Next three lines passing the font type, size, and color
    myTextFormat.font = "Celestial";
    myTextFormat.size = 10;
    myTextFormat.color=0xFF0000;
    //applies this textformat to the "wordcontainer.wordtextbox" text box.
    wordcontainer.wordtextbox.setTextFormat(myTextForm at);


    so far so good, I can see that the movie clip behaves properly

    I now try to duplicate this movie clip which also works properly:

    Code:
    for(i=0;i<5;i++){
    name = "word" + i;
    trace(name + " " + " " + _root.wordcontainer._width);
    spacing = _root.wordcontainer._width +5;
    _root.wordcontainer.duplicateMovieClip(name, i);
    _root[name].wordtextbox.text = name;
    trace(_root[name].wordtextbox.text);
    _root[name]._x =(i*spacing) + 20;
    _root[name]._y = 180 ;


    }


    the problem is that although the movie clip is duplicated this line
    doesnt work:

    _root[name].wordtextbox.text = name;

    I havnt got a clue why its not working

    I am trying to dynamically generate a list of words with specific font
    , size and colour attributes

    thanks in advance

    ped
    ped Guest

  2. Similar Questions and Discussions

    1. Alternate Dynamic Table Row Colour
      I have managed to display dynamic data in a table in several web pages on my site. However, I would like to display alternate rows in a different...
    2. Dynamic textbox
      Flash MX question: Is it possible to insert a variable inside a dynamic textbox with scrollbar? Like this: Your name is ?? thx, Diederik
    3. Textbox Font and Fontsize in Edit Mode
      How do I change the textbox font and fontsize in Edit Mode? Thanks, -Dave
    4. html tags in dynamic textbox
      Hi everyone I read a lot of messages here regarding problems approaching mine... but no solution. I have a dynamic textbox, whose variable name...
    5. How to stop font width expanding when textbox is resized
      How to stop font width expanding when textbox is resized Hi, I am new to this Forum and to Fireworks MX. I am trying to create buttons and...
  3. #2

    Default Re: Dynamic font and colour changes to textbox


    "ped" <pedmk801@yahoo.co.uk> wrote in message
    news:f3b56016.0309110616.66efed66@posting.google.c om...
    > Hi NG,
    hi

    I hope this helps

    // default container
    _root.wordcontainer.wordtextbox.text = "myWord";

    //Code:
    for(i=0;i<5;i++){
    name = "word" + i;
    //trace(name + " " + " " + _root.wordcontainer._width);
    spacing = _root.wordcontainer._width -50;
    _root.wordcontainer.duplicateMovieClip(name, i);
    _root[name].wordtextbox.text = name;
    // trace(_root[name].wordtextbox.text);
    _root[name]._x =(i*spacing)+10;
    _root[name]._y = 130 + (i * 35);

    // formatting text
    myTextFormat = new TextFormat();
    //Next three lines passing the font type, size, and color
    myTextFormat.font = "Verdana";
    myTextFormat.size = 10 + i;
    myTextFormat.color=0xFF0000;

    //applies this textformat to the "wordcontainer.wordtextbox" text box.
    wordcontainer.wordtextbox.setTextFormat(myTextForm at);
    //applies this textformat to the dynamically generated "wordtextbox" text
    box.
    _root[name].wordtextbox.setTextFormat(myTextFormat);
    }

    It generates five objects with different text and size of text.

    --
    Chule
    [url]www.uraa.com[/url]
    [url]http://mls.f2o.org/nomadi[/url]
    [url]http://newsgrupe.tk[/url]


    Igor Cuckovic Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139