A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Can i do this?

  1. #1
    Member
    Join Date
    Dec 2001
    Posts
    69

    Can i do this?

    Version Flash Mx
    Platform win 98/2 pc
    duplicate an MC with text box inside, then load a different .as {html formatted file} into each one?
    I can't seem to get this to work

    while (RecordAmount>0) {
    duplicateMovieClip(_root.record, "newrecord"+i, i);
    setProperty("newrecord"+i, _x, _root.record._x);
    setProperty("newrecord"+i, _y, _root.record._y += 100);
    RecordLink = "x"+i+".jpg";
    collect += RecordLink;
    m += 1;
    loadMovie(RecordLink, "mc"+i);
    RecordLink = "";

    i++;
    RecordAmount--;

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    1,835
    you've got yourself into a bit of a muddle with your code, try this amended version:

    code:
    var i = 0, newMC, recordLink;
    while (RecordAmount>0) {
    _root.record.duplicateMovieClip("newrecord"+i, i);
    newMC = _root["newrecord" + i];
    newMC._y += 100*i;
    recordLink = "x"+i+".jpg";

    // debug output
    trace("loading picture: " + recordLink);

    collect += recordLink;
    newMC.loadMovie(recordLink);
    i++;
    RecordAmount--;
    }



    setProperty was used in Flash 4 and has been outdated since Flash 5, by the way

  3. #3
    Member
    Join Date
    Dec 2001
    Posts
    69
    Can I use a loadvariables action in there to load different text files into each text MC that has been created?

    I can't get my head around how to change the variable that links the text box and the external file.

    Thankyou

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Posts
    1,835
    Yes, you can. Just change two lines:

    recordLink = "x"+i+".jpg";
    becomes
    recordLink = "textfile" + i + ".txt";

    and

    newMC.loadMovie(recordLink);
    becomes
    newMC.loadVariables(recordLink);

    This will load textfiles called 'textfile0', 'textfile1', 'textfile2', etc. into the corresponding movie clips.

    - n.

  5. #5
    Member
    Join Date
    Dec 2001
    Posts
    69
    OK i see what is going on there. Now I have another angle.
    How do you think if at all i could utilise the #include("textfile.as")
    This option would enable some html formatting in the text to go into the MC's
    Thanks for your help again.

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