# Problem with XML gallery

**URL:** <https://forum.kirupa.com/t/problem-with-xml-gallery/276954>\
**Category:** Uncategorized\
**Created:** [December 5, 2008, 3:03pm UTC](https://forum.kirupa.com/t/problem-with-xml-gallery/276954 "2008-12-05T15:03:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benny1989](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@benny1989](https://forum.kirupa.com/u/benny1989)\
**Post date:** [December 5, 2008, 3:03pm UTC](https://forum.kirupa.com/t/problem-with-xml-gallery/276954/1 "2008-12-05T15:03:49Z")

</div>

Hi,  
I’m pretty new to as3, and i’m having problems converting a xml gallery that used timeline actionscript, to a xml gallery that’s being controlled by a class file. Here is my code for the attempted class file version;

```auto

package {
 
      import flash.display.Loader;
      import flash.display.Sprite;
      import flash.events.Event;
      import flash.net.URLLoader;
      import flash.display.MovieClip;
      import flash.events.MouseEvent;
      import flash.net.URLRequest;
      import caurina.transitions.Tweener;
 
           public class Gallery extends MovieClip {
 
               var xmlLoader:XML;
               var imageLoader:Loader;
               var xml:XML;
               var xmlList:XMLList;
               public function Main() {
               xmlLoader.load(new URLRequest("images.xml"));
               xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
               }
 
               function xmlLoaded(event:Event):void {
 
                    xml = XML(event.target.data);
                    xmlList = xml.children();
 
                    for (var i:int = 0; i < xmlList.length(); i++) {
 
                     imageLoader = new Loader();
                     imageLoader.load(new URLRequest(xmlList*.attribute("thumb")));
                     imageLoader.x = 25;
                     imageLoader.y = i * 150 + 25;
                     imageLoader.name = xmlList*.attribute("source");
                     addChild(imageLoader);
                     imageLoader.addEventListener(MouseEvent.MOUSE_OVER, showPicture);
                     trace("working");
                         }
                 }
 
                 function showPicture(event:MouseEvent):void {
 
                      imageLoader = new Loader();
                      imageLoader.load(new URLRequest(event.target.name));
                      imageLoader.alpha = 0;
                      imageLoader.x = 400;
                      addChild(imageLoader);
                      Tweener.addTween(imageLoader,{alpha:1,time:36,delay:2,transition:"easeOutBack",useFrames:true});
                 }
 
        }
}
 

```

But when I run the file, the following errors are displayed;

Warning: 3594: load is not a recognized method of the dynamic class XML.  
Warning: 3594: addEventListener is not a recognized method of the dynamic class XML.

here is the code for the xml gallery using the as3 on the timeline;

```auto

import caurina.transitions.Tweener;
 
var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
 
xmlLoader.load(new URLRequest("images.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
 
function xmlLoaded(event:Event):void {
 xml = XML(event.target.data);
 xmlList = xml.children();
 for (var i:int = 0; i < xmlList.length(); i++) {
  imageLoader = new Loader();
  imageLoader.load(new URLRequest(xmlList*.attribute("thumb")));
  imageLoader.x = 25;
  imageLoader.y = i * 150 + 25;
  imageLoader.name = xmlList*.attribute("source");
  addChild(imageLoader);
  imageLoader.addEventListener(MouseEvent.MOUSE_OVER, showPicture);
  trace("working");
 }
}
 
function showPicture(event:MouseEvent):void {
 imageLoader = new Loader();
 imageLoader.load(new URLRequest(event.target.name));
 imageLoader.alpha = 0;
 imageLoader.x = 400;
 addChild(imageLoader);
 Tweener.addTween(imageLoader,{alpha:1,time:36,delay:2,transition:"easeOutBack",useFrames:true});
}
 

```

Sorry if my explanation was vague.  
Thanks  
Benny
