A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: NEED SUGG- DUP MC AND LOAD VARIABLES

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    18
    HEY.

    I have the following code i am trying to modify to fit my needs and im looking for some suggestions.

    //frame 1
    num = 15;
    ypos = 10;
    n = 1;
    while (n <= num) {
    duplicateMovieClip ("button", "button" add n, n);
    setProperty ("button" add n, _y, ypos + n*32);
    n = n + 1;
    }
    setProperty ("button", _visible, 0);


    The MC "button" contains 2 variables that need to be changed as the MC is duplicated.

    The first variable is "Book"
    The second variable is "Title"

    I want to be able to load these variables from a txt file externally, to make the editing process a bit less painless, and have the MC duplicate and insert the values of Book, Title, then the next duplicate would have Book1, Title1, etc, from what i would have in the text file.

    I understand the process of duplicating the main MC, "button" as scripted above, although i am lost as to how to control the naming of the dynamic text boxes (holding the Book and Title variables) in each duplicated MC, so i can link these variables from the text file.

    Anyone have any good ideas?

    thanks
    eric

  2. #2
    this might work (but i haven't tested it):

    since each duplicated instance has a name (button1, button2, etc. . ) you should be able to just target the text boxes this way: button1.Book, button2.Title.

    here is the part i am guessing on: if you have the variable that is being passed in called button1.Book instead of Book1, maybe it will work.

    hope that helps.

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