A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How can I display text from an array to a table?

  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    26
    I want to create a calendar.
    How can I display the different dates so that all columns are lined up? I can't just create a single textfield because kerning prevents the different rows from lining up.
    I have tried duplicating movie clips which contain text fields, but I cannot change the value of the text field in that movie.
    Any suggestions?

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    111
    clip in lib called 'day' with text field 'text'
    do
    i++;
    attachmovieclip('day',"day"+i,i);
    _root['day'+i].text = arrayofdatesname i;
    while i < arrayofdatesname.length

    done

    the syntax here is wrong 'cos it wont display if I put it in right

  3. #3
    Junior Member
    Join Date
    Nov 2001
    Posts
    16
    Actually, duplicating the movie clips should work. To change the values in the text fields, try something like this. It's kind of brute-force, but it works for a quickie demo:

    1) Create a movie clip of a calendar row called "mcRow". Each row of the calendar contains 7 text fields, each the same width/height. Name them txt0 to txt6, or something else you find useful. Naming them 0 to 6 lets you match the text field's name with the result from the Date object's getDay() function.

    2) Duplicate the mcRow movie clip to create your calendar rows. Call them mcRow0 to mcRow5. There are a maximum of six weeks possible in a month (such as March 2002).

    3) Now you can refer to each particular text field in each movie clip by instance name. For example, for March 2002, if you want to set something in today's date's text field, do this:

    mcRow4.txt6.text = "23";

    Or to put a note in March 21's text field:

    mcRow4.txt4.text = "21\nFirst day of spring";


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