dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: XML and Variables

Threaded View

  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    10

    XML and Variables

    Greetings!

    I am developing an application in Flash MX. Each frame of my MAIN MOVIE is a screen. Each frame calls out to an XML doc for content (text, graphics, etc) which is loaded into the appropriate movieclips that make up each screen. I am new to XML, but I have been able to get everything to work as planned.

    My XML is relatively simple, for instance:

    PHP Code:
    <screen>
    <
    title>Welcome</title>
    <
    text1>blahblahblah</text1>
    <
    text2>yaddayadda</text2>
    </
    screen
    In the above example, I would add AS to frame 1 declaring variables for "title", "text1", and "text2". However, frame 2 may call an XML doc that looks like this:

    PHP Code:
    <screen>
    <
    title>Lesson One</title>
    <
    subtitle>blahblah</subtitle>
    <
    text1>yaddayadda</text1>
    </
    screen
    I would go to frame two and add AS to declare these variables ("title", "subtitle", and "text1"). The point is that every frame in my movie is calling a different XML doc with different nodes (and a different NUMBER of nodes...) requiring different AS on every frame.

    My question is, is there a "universal" code that would automatically 1) find the number of child nodes in a given XML doc, 2) declare each one of those nodes as variables, and 3) set the variable value to its nodeValue?

    I can ususally find answers to my questions on this site, but I haven't been so lucky with this one (more than likely I've come across my solution already, but didn't recognize it). Any insight would be greatly appreciated!

    N
    Last edited by tupps; 10-09-2005 at 05:05 PM. Reason: Added code tags around the code so that the xml was visible

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