# Xml and flash

**URL:** <https://forum.kirupa.com/t/xml-and-flash/260138>\
**Category:** Uncategorized\
**Created:** [May 12, 2008, 9:53pm UTC](https://forum.kirupa.com/t/xml-and-flash/260138 "2008-05-12T21:53:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vectar](https://avatars.discourse-cdn.com/v4/letter/v/b2d939/32.png) [@Vectar](https://forum.kirupa.com/u/Vectar)\
**Post date:** [May 12, 2008, 9:53pm UTC](https://forum.kirupa.com/t/xml-and-flash/260138/1 "2008-05-12T21:53:52Z")

</div>

i need to make a flash file. with a textfield on frame 1 and on frame 20 and on frame 40 and the content for those textfields needs to be read from a xml file.  
Textfield 1 is slogan 1 textfield 2 is slogan 2 and textfield 3 is slogan 3  
can someone tell me how to do this or maybe even make a quick mockup for me ?

thanks in advance

---

<div class="post-metadata">

**Author:** ![sparkdemon](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sparkdemon](https://forum.kirupa.com/u/sparkdemon)\
**Post date:** [May 13, 2008, 7:58am UTC](https://forum.kirupa.com/t/xml-and-flash/260138/2 "2008-05-13T07:58:02Z")

</div>

put up the xml format (or atleast the content for the three text boxes)… so that we can see what the code has to extract.

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [May 13, 2008, 8:07am UTC](https://forum.kirupa.com/t/xml-and-flash/260138/3 "2008-05-13T08:07:21Z")

</div>

try looking at the xml examples in the tutorial section…

---

<div class="post-metadata">

**Author:** ![Vectar](https://avatars.discourse-cdn.com/v4/letter/v/b2d939/32.png) [@Vectar](https://forum.kirupa.com/u/Vectar)\
**Post date:** [May 14, 2008, 8:33am UTC](https://forum.kirupa.com/t/xml-and-flash/260138/4 "2008-05-14T08:33:06Z")

</div>

What i need is very simple to explain.  
Its just a flash file size doesn’t matter. with 2 dynamic textfields on frame 1 and the same on frame 20 and again 2 on frame 40. SO only one layer with pure textfields.  
on frame 1 should come a title and a quote and on frame 20 a new title and quote and also on frame 40. But i want these textfields to be filled with xml content.  
The XML file should be this:

```auto

<intro>
   <item>
      <title>title 1</title>
	<quote>
                 Place quote number 1
             </quote>
   </item>
   <item>
      <title>title 2</title>
             <quote>
                Place quote number 2
             </quote>
   </item>
   <item>
      <title>title 3</title>
             <quote>
                Place quote number 3
             </quote>
   </item>
</intro>

```

---

<div class="post-metadata">

**Author:** ![Pier25](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pier25](https://forum.kirupa.com/u/Pier25)\
**Post date:** [May 14, 2008, 8:45am UTC](https://forum.kirupa.com/t/xml-and-flash/260138/5 "2008-05-14T08:45:07Z")

</div>

You could simply do this

\<intro\>  
\<item title=“super title!!” quote=“remember remember the fifth of november”/\>  
\<item title=“super title 2!!” quote=“I’m your father”/\>  
\<item title=“super title 3!!” quote=“You’re the one”/\>  
\</intro\>

and then use xmlObject from sephiroth, or parse the xml “by hand” to get that data.

If using the xmlObject calling a data of the xml (after parsing it) is as simply as this:

my\_textfield.text = xml\_object.intro.item[0].attributes.title //that would be “super title!!”

---

<div class="post-metadata">

**Author:** ![Vectar](https://avatars.discourse-cdn.com/v4/letter/v/b2d939/32.png) [@Vectar](https://forum.kirupa.com/u/Vectar)\
**Post date:** [May 14, 2008, 1:10pm UTC](https://forum.kirupa.com/t/xml-and-flash/260138/6 "2008-05-14T13:10:25Z")

</div>

okay this makes sense but my skills are not so good with xml.  
SO basically i place a simple xmlObject code.  
And for everytextfield i make the line

my\_textfield.text = xml\_object.intro.item[0].attributes.title //that would be "super title!!"  
my\_textfield.text = xml\_object.intro.item[1].attributes.quote //that would be “quote”

am i right ?  
But how does title 2 and title 3 go to frame 20 and 40 ?

---

<div class="post-metadata">

**Author:** ![Pier25](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pier25](https://forum.kirupa.com/u/Pier25)\
**Post date:** [May 14, 2008, 2:02pm UTC](https://forum.kirupa.com/t/xml-and-flash/260138/7 "2008-05-14T14:02:43Z")

</div>

code in frame 1:  
my\_textfield.text = xml\_object.intro.item[0].attributes.title //that would be “super title!!”

code in frame 20:  
my\_textfield.text = xml\_object.intro.item[1].attributes.title //that would be “super title!!”

code in frame 40:  
my\_textfield.text = xml\_object.intro.item[2].attributes.title //that would be “super title!!”

Remember! To have this kind of syntax you need to use the sephiroth class  
[http://www.sephiroth.it/file\_detail.php?id=134](http://www.sephiroth.it/file_detail.php?id=134)

It’s easy to install and use, just check the example included on how to parse the file. 😉
