A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: duplicateMovieClip

  1. #1
    Junior Member
    Join Date
    Nov 2001
    Posts
    27
    beginner's question:

    I want to use the duplicateMovieClip command to help populate a simple menu list of dynamic text fields.

    1. Will I need to create a movie to contain the dyn text fields? (I assume I cannot call duplicateMovieClip on text fields. Can you in Flash MX?)

    2. How do I pass the vars i need into this movie clip? Such as the dyn text varname? I know I can name the new movie clip, but it doesn't seem obvious to me how to name the dyn text field. they need to have the name ["faqa" + variablename]

    thanks!

  2. #2
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Firstly create your dynamic text field, name it (I dunno, "Colin") and then convert it to a movie clip, and then name that instance.

    Do your duplicateMovie thing. Normally you'd do that within a loop so your menu will be made up of movie clips named clip1, clip2 etc. yeah ?

    Then to reference the dynamic text field you would use

    clip1.Colin="Wow, it works";

    i.e. you reference it the same as you would a var within a movieclip, or even a mc's property ( ie. _x, _y, _alpha etc. )

    Hope that helps...

    Squize.

    PS Download http://www.shoah.co.uk/calendar.zip where I've done that. It's beta code but the bit you want works !

  3. #3
    Junior Member
    Join Date
    Nov 2001
    Posts
    27

    well...

    but is there a way that i can change the name of the dyn text field within my duplicate movie clips? the reason i need this, is because i have all of my menu items stored in a txt file that i want to call in. The txt file looks like this:

    filename: faq.txt

    &faq1=This will be on line 1
    &faq2=This will be on line 2
    &faq3=This will be the third line
    and so on...

    I want to be able to do a
    loadVariable ("faq.txt", "mc_name")
    for each movie, and then the corresponding line of text will be read into each movie.

    I could do it without naming the dyn text fields, but then I would have to have separate txt files for each movie, which seems too messy.

    thanks.

  4. #4
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    I kinda see what your getting at but can't you just load in the txt file and then make the dynamic text fields equal to the different strings ?

    So you would

    loadVariablesNum ("faq.txt",0);

    Then once that is loaded your swf will be aware of the vars

    faq1=This will be on line 1
    faq2=This will be on line 2
    faq3=This will be the third line

    and from there use my earlier example to stuff those values into the textfields, eg

    clip1.Colin=faq1;

    This could be done in the duplicateMovie loop.

    Check out the fla, it loads an xml file and from there decides which clip to duplicate, shoves values into textfields etc. ( If you want the current build then email me ).

    Hope that's some help,

    Squize.

  5. #5
    Junior Member
    Join Date
    Nov 2001
    Posts
    27

    ah..

    ok i think i see where you're going with that. i'll give that a shot. thanks!

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