Dynamic Text Value???

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

  1. #1

    Default Dynamic Text Value???

    Hi all,

    I'm stumped by the following code:

    for(i=0; i<100; i++) {
    tellTarget ("sq"+(i+1))
    {numval = i};
    trace(i+1);
    }

    I have 100 instances of a movieclip named "sq1...100" each with a
    dynamic text box with a variable named "numval". The code above traces
    1 to 100 but the movieclip.dynamictext for each is BLANK!!. If I
    replace {numval = i} with {numval = 30) they all have a thirty in them.
    If I use {numval = "x") they all have an x in them.
    Please help.

    Fain

    cowiefr@yahoo.com Guest

  2. Similar Questions and Discussions

    1. load external text to dynamic text field in levels
      Dear Sir I found the Tech Noe Index #16238 is useful in creating dynamically loaded text from external text file. However, the method mentioned...
    2. Dynamic text box within dynamic movie clip
      I'm having a similar problem. On mine I noticed that although the text doesn't show and the border doesn't show, the cursor changes appropriately...
    3. How to center text in dynamic HTML text field ???
      In Flash MX 2004 I suddenly find myself comletely helpless trying to align all text to the center in my dynamic text field. I dont recall running...
    4. Dynamic text fields. Continuing text over columns
      Hi I'm doing a mock up news paper article over 4 columns in flash mx and the text loads in dynamically. I have 4 dynamic text boxes sitting side...
    5. Dynamic Text Loaded from Text files -> Flash 5 <-
      I was wondering how I can dynamically load text into a text box from a text file using Flash 5. I've seen plenty infos how to do it with Flash MX but...
  3. #2

    Default Re: Dynamic Text Value???

    for(i=0; i<100; i++) {
    tellTarget ("sq"+(i+1))
    {numval = i};
    trace(i+1);
    }

    that is going to copy the value of 'i' in your sq1 to variable 'numval' in
    sq1 etc .. it won't even look at the value of 'i' in your loop, because of
    the tellTarget.

    if the above code was in a function , and you used

    for (var i=0; i<100; i++) {
    ....
    }

    then it would work, as local variable are found first regardless of the
    tellTarget saying to look elsewhere.
    --
    All the best,
    Jeckyl


    Jeckyl Guest

  4. #3

    Default Re: Dynamic Text Value???

    Try changing it to:

    for(i=0; i<100; i++) {
    eval("sq"+(i+1)).numval = i;
    }

    or, if the i+1 bit misbehaves,

    for(i=1; i<=100; i++) {
    eval("sq"+i).numval = i-1;
    }

    not the neatest thing ever, but I use it loads!
    -JP
    [url]http://www.maths-pgce.co.uk/[/url]


    JP Guest

  5. #4

    Default Re: Dynamic Text Value???

    Thanks guys. I got it working.

    cowiefr@yahoo.com 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