# Load swf and target url from a (nasty) PHP/XML

**URL:** <https://forum.kirupa.com/t/load-swf-and-target-url-from-a-nasty-php-xml/260554>\
**Category:** flash\
**Created:** [May 16, 2008, 5:50pm UTC](https://forum.kirupa.com/t/load-swf-and-target-url-from-a-nasty-php-xml/260554 "2008-05-16T17:50:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flash\_forum](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@flash\_forum](https://forum.kirupa.com/u/flash_forum)\
**Post date:** [May 16, 2008, 5:50pm UTC](https://forum.kirupa.com/t/load-swf-and-target-url-from-a-nasty-php-xml/260554/1 "2008-05-16T17:50:15Z")

</div>

(Sorry for my english)

Hello!

Please help me! :bounce:

I want load a SWF from PHP/XML.

The source:  
http://… /xml/… .php

The source-code:  
\<?xml version=“1.0” encoding=“UTF-8”?\>\<ads\>\<ad targeturl=“http://…” imagesrc=“http://… .swf” width="…" height="…"\>\</ad\>\</ads\>

I need two object: the SWF (from XML) and a canvas above this with a transparency button with URL (from XML)…

How can I do this? 👁

Please send me an email, too: [flashforum@freemail.hu](mailto:flashforum@freemail.hu)

Thanks’!!!

---

<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 16, 2008, 6:56pm UTC](https://forum.kirupa.com/t/load-swf-and-target-url-from-a-nasty-php-xml/260554/2 "2008-05-16T18:56:12Z")

</div>

1. your load your xml with the standard procedure: read the manual

2. you parse your xml by hand (firstChild, array.push, etc) OR automatically with xml Object from sephiroth

3. wether you have some arrays, or a data object you then create a for loop to extract the data and make something with it.

---

<div class="post-metadata">

**Author:** ![flash\_forum](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@flash\_forum](https://forum.kirupa.com/u/flash_forum)\
**Post date:** [May 19, 2008, 12:47pm UTC](https://forum.kirupa.com/t/load-swf-and-target-url-from-a-nasty-php-xml/260554/3 "2008-05-19T12:47:36Z")

</div>

OK, thanks… :3ye:

But I think you can make the code about one minute! :thumb2:

I need from this:

\<?xml version=“1.0” encoding=“UTF-8”?\>\<ads\>\<ad targeturl=“http://…” imagesrc=“http://… .swf” width="…" height="…"\>\</ad\>\</ads\>

to this:  
\<flashobjects\>  
\<flashobject\>  
\<object\>… .swf\</object\>  
\<link\>http:// …\</link\>  
\</flashobject\>  
\</flashobjects\>

:block:

[QUOTE=Pier25;2327270]1) your load your xml with the standard procedure: read the manual

1. you parse your xml by hand (firstChild, array.push, etc) OR automatically with xml Object from sephiroth

2. wether you have some arrays, or a data object you then create a for loop to extract the data and make something with it.[/QUOTE]

---

<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 19, 2008, 12:57pm UTC](https://forum.kirupa.com/t/load-swf-and-target-url-from-a-nasty-php-xml/260554/4 "2008-05-19T12:57:51Z")

</div>

using **“attribute”** helps

\<xml intro\>  
\<list\>  
\<item id=“1” object=“http://” link =“http” /\>  
\<item id=“2” object=“http://” link =“http” /\>  
\</list\>

then it would be something like

linkvariable = this.childNode[0].childNode\*.attribute/s.link

---

<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 19, 2008, 1:55pm UTC](https://forum.kirupa.com/t/load-swf-and-target-url-from-a-nasty-php-xml/260554/5 "2008-05-19T13:55:04Z")

</div>

[QUOTE=flash-forum;2328093]OK, thanks… :3ye:

But I think you can make the code about one minute! :thumb2:  
[/QUOTE]

Hey come on, you’ll never learn actionscript if I do it for you 😉

If you install the xmlObject and read the examples you’ll see it’s really easy…

Loading the xml: read the flash manual and then copy paste

Parse the XML with xmlObject: read the example and copy paste, it’s 2 lines of code.

then you do a “for” loop do whatever you want it to do…
