A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AttachMovie Object count problem

  1. #1
    Junior Member
    Join Date
    May 2005
    Posts
    10

    AttachMovie Object count problem

    I've the following script:

    code:

    for (i=0; i<get("xmldata_archive_nr_of_items"); i++) {


    var test = get_property("archive", "event_date_full", i)+" - "+get_property("archive", "venue", i)+" - "+get_property("archive", "city", i);

    item = _root.attachMovie("itemClip", "itemClip"+i, i);
    item._x = 0;
    item._y = 20*i;
    item.itemLabel.text = test;
    }


    for (i=0; i<get("xmldata_archive_nr_of_items"); i++) {


    if(get("xmldata_archive_"+i+"_gallery_nr_of_items" )){
    for(j=0;j<get("xmldata_archive_"+i+"_gallery_nr_of _items");j++){

    pic = _root.attachMovie("picItem","picItem"+j, j);
    pic._x = 100*j;
    pic._y = 250;
    pic.loadMovie(get_property("archive_"+i+"_gallery" , "thumbnail", j));
    }
    }
    }



    Objects output:

    Movie Clip: Frame=1 Target="_level0.picItem0"
    Shape:
    Movie Clip: Frame=1 Target="_level0.picItem1"
    Shape:
    Movie Clip: Frame=1 Target="_level0.itemClip2"

    I expect output to be:
    Movie Clip: Frame=1 Target="_level0.picItem0"
    Shape:
    Movie Clip: Frame=1 Target="_level0.picItem1"
    Shape:
    Movie Clip: Frame=1 Target="_level0.itemClip0"

    So why does this script doesn't count the objects separate?

  2. #2
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    It looks like you may be overwriting itemClip0, itemClip1 as you may be using the same depths for both sets of attachMovies, i.e. both 0 and 1. Try something like

    _root.attachMovie("picItem","picItem"+j, j + 100);

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