troubleshooting Question

How do I attachMovie through xml

Avatar of SimonAdrian
SimonAdrian asked on
Adobe Flash
6 Comments1 Solution433 ViewsLast Modified:
I need to initiate a function through xml, but cant figure out the actionscript.
I have two or more small movies that I want to place on the stage in different places through xml.
The function should attach the movie to the stage, but also retrieve its initiation and informations from a xml-file.
 
this.attachMovie("mosquito", "instance1", 999, {_x:22, _y:100}); // identifier, instancename, level, x-position, y-position
Here is my idea of the xml-file:
<?xml version="1.0"?>
<insects>
          <bug>
               <type>flie</type>
                <typenumber>1</typenumber>
                <level>97</level>
                <xposition>56</xposition>
                <yposition>150</yposition>
          </bug>
          <bug>
                <type>mosquito</type>
                <typenumber>1</typenumber>
                <level>98</level>
                <xposition>217</xposition>
                <yposition>150</yposition>
         </bug>
         <bug>
                 <type>flie</type>
                 <typenumber>2</typenumber>
                 <level>99</level>
                 <xposition>22</xposition>
                  <yposition>100</yposition>
          </bug>
<insects>

or if neccessary it could be an xml-string consisting of attributes.
<insects>
          <bug type="flie" number="1" level="97" xposition="22" yposition="150" />
          <bug type="mosquito" number="1" level="98" xposition="212" yposition="250" />
          <bug type="flie" number="2" level="99" xposition="83" yposition="350" />
</insects>


So everytime I add a new bug, the type-element/attribute defines which bug-movie in the library to choose, the typenumber-element/attribute defines the instancename+number, the level-element defines the level of the instance and the x- and y-position-elements defines the position of the movie.
The actionscript should somehow make sure that the instancename-number follows the name of the bug-movie. So if the first type is flie the instancename would be flie1.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros