dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: I have a duplication problem

  1. #1
    Senior Member
    Join Date
    Nov 2001
    Location
    Houston TX
    Posts
    563

    I have a duplication problem

    Hi,
    I hope there is someone out there that can help me understand how to
    reference MC's duplicated inside MC's.

    OK, here is what I have. I created an empty MC to hold an image that will be
    loaded from an XML file. I also created a dynamtic text box in another MC.
    This to will be loaded with text coming from the same XML.

    The next thing I did was to take those two MC's and put them in a third MC
    on own layer. The two MC's are placed side by side. On a third layer I placed
    a button which only has the hit area made the rest are blank. I place the
    button over the top of the two MC's. This new MC will be used in a forth MC
    which will have a duplicate function to create as many dups as needed from
    the amount of items in the XML file.

    After completing the over all MC which has all the duped MC's in it I load it
    into a scrollPlane.

    Here is my problem. I can't seem to reference anything inside the MC which
    holds the duped MC's to dynamicly fill each duped MC.

    IF you know how or know of a tutorial to do this I would greatly thankful.

    Best regards
    Toby
    Best regards
    Toby Mack

    For the best and funniest Audio Blog on the Internet come visit:

    http://feeds.feedburner.com/Fla****UpBlog

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    FL, USA
    Posts
    443
    Code:
    //maxEntries is just a var for your total # of image/text pairs
    maxEntries = 6;
    for(i=2; i<maxEntries; i++) {
    duplicateMovieClip("mc1" , "mc"+i , this.getNextHighestDepth());
    }
    //Now you have mc1, mc2, ... mc6
    //To reference a particular one...
    mc3.textBox.text = xmlObject.text3; //The text var created in your xml object
    //To reference all...
    for(i=1; i<maxEntries; i++) {
    this["mc"+i].textBox.text = xmlObject["text"+i]; //All text vars created in your xml object
    }

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Location
    Houston TX
    Posts
    563
    Bob,
    Thanks for the quick reply.
    Would I reference the empty MC for load the image the same way?
    And also the button?
    mc3.imageStage.image = xmlObject.image3

    Thanks
    Toby
    Best regards
    Toby Mack

    For the best and funniest Audio Blog on the Internet come visit:

    http://feeds.feedburner.com/Fla****UpBlog

  4. #4
    Senior Member
    Join Date
    Apr 2005
    Location
    FL, USA
    Posts
    443
    Yes, but remember that dynamic text doesn't support the <img> html tag, so you will have to either display the images dynamically...
    Code:
    loadMovie("image"+i+".jpg" , this["mc"+i].imageHolder);
    ...or import all the images into flash first, put em in a MC, and do...
    Code:
    this["mc"+i].imageMC.gotoAndStop(i);

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