# Adding elements to xml page, as3

**URL:** https://forum.kirupa.com/t/adding-elements-to-xml-page-as3/249028
**Category:** Uncategorized
**Created:** [January 14, 2008, 7:53pm UTC](https://forum.kirupa.com/t/adding-elements-to-xml-page-as3/249028 "2008-01-14T19:53:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kagamushu](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@kagamushu](https://forum.kirupa.com/u/kagamushu)
#### Post date: [January 14, 2008, 7:53pm UTC](https://forum.kirupa.com/t/adding-elements-to-xml-page-as3/249028/1 "2008-01-14T19:53:54Z")

</div>

Hello all,  
i was wondering how to add elements to an xml page. When I click on the thumbnail, the video loads in the player, and “image” loads beside it. I would like to add a sub scrollpanel for each video loaded (diplaying the chapters of the video). For now though, I am just trying to find the correct place to put it in the xml page. It seems the only elements flash recognizes are description, path, and data. here is my code:

\<content\>   
\<item\>  
\<description\>image\</description\>  
\<path\>thumbnail\</path\>  
\<data\>video\</data\>  
\<type\>\</type\>

\</item\>

As you can see, all the elements here are assigned except for type. If i add a .jpg or a .flv in type, i get the following error:  
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.  
The path is correct though. Any ideas? Here is my AS:

import fl.video.VideoEvent;  
import flash.events.MouseEvent;  
import com.afcomponents.scrollpanel.ScrollPanelEvent;  
import flash.display.Loader;  
import flash.display.LoaderInfo;  
import flash.net.URLRequest;  
import flash.net.navigateToURL;

function loadComplete(event:ScrollPanelEvent){  
myScroll.addGenericItemEventListener(MouseEvent.CLICK, playOnClick);  
video1.source = myScroll.getSelectedItem().data;

var imageLoader:Loader = new Loader();  
var myRequest:URLRequest = new URLRequest(myScroll.getSelectedItem().description);  
imageLoader.load(myRequest);  
addChild(imageLoader);  
imageLoader.y = 160;  
imageLoader.x = 22;

}

myScroll.addEventListener(ScrollPanelEvent.XML\_LOAD\_COMPLETE, loadComplete);

function playOnClick(event:MouseEvent) {  
video1.source = event.target.data;  
//variable to load clicked video data from description field  
var imageLoader:Loader = new Loader();  
var myRequest:URLRequest = new URLRequest(event.target.description);  
imageLoader.load(myRequest);  
addChild(imageLoader);  
imageLoader.y = 160;  
imageLoader.x = 22;

var imageLoaderb:Loader = new Loader();  
var myRequestb:URLRequest = new URLRequest(event.target.type);  
imageLoaderb.load(myRequestb);  
addChild(imageLoaderb);  
imageLoaderb.y = 260;  
imageLoaderb.x = 22;

}

thanks
