A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: For Each Child in XML - Create Movie Clip

  1. #1
    Senior Member
    Join Date
    Jul 2007
    Posts
    243

    For Each Child in XML - Create Movie Clip

    i am currently working on my portfolio, and one of the main things i want to do is load my images and swfs from xml.

    at the minute i am just trying to load the right number of containers for the number of files in the xml.

    i understand the logic of what needs to happen, but am unsure of a few coding snippets.
    i think once i load in my xml file it will be something like

    for each var item in xmlData.image //image being the xml element
    {
    clip = new movieclip()
    }

    i'm not sure if there needs to be a counter so it goes throgh and counts and then displays them, at the moment i just want to work on that, and maybe get a gap between each one so i can see them loading in.

    i'm going to keep looking at it but if anybody can help me out with an example or sample code that would be great

    thanks
    Dan

  2. #2
    Senior Member
    Join Date
    Jul 2007
    Posts
    243
    ok quick update:
    i've got it to
    PHP Code:
    function LoadXML(e:Event):void 
    xmlData = new XML(e.target.data); 
    for 
    each (var item in xmlData.item
    {
     
    i++;
     
    trace(i);
    }

    which returns 1,2,3,4...19 (number of nodes in my xml) so i can get it to count, now i just need to display "i" number of movieclips with a xPos of +20, not sure how to do that but ill keep looking, but if anybody can help me out stil that would be great

  3. #3
    Senior Member
    Join Date
    Jul 2007
    Posts
    243
    still not solved this one after working on it all morning.
    anybody have any advice?

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